Commit 782dcf27 authored by 高宇's avatar 高宇

打包压缩

parent 047fb8fb
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
}, },
"dependencies": { "dependencies": {
"crypto-js": "4.1.1",
"compression-webpack-plugin": "^1.1.12",
"dsbridge": "^3.1.4", "dsbridge": "^3.1.4",
"@riophae/vue-treeselect": "^0.4.0", "@riophae/vue-treeselect": "^0.4.0",
"axios": "0.18.1", "axios": "0.18.1",
......
...@@ -14,6 +14,9 @@ function resolve(dir) { ...@@ -14,6 +14,9 @@ function resolve(dir) {
const name = defaultSettings.title || 'vue Admin Template' // page title const name = defaultSettings.title || 'vue Admin Template' // page title
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
// If your port is set to 80, // If your port is set to 80,
// use administrator privileges to execute the command line. // use administrator privileges to execute the command line.
// For example, Mac: sudo npm run // For example, Mac: sudo npm run
...@@ -52,7 +55,6 @@ module.exports = { ...@@ -52,7 +55,6 @@ module.exports = {
// lintOnSave: process.env.NODE_ENV === 'development', // lintOnSave: process.env.NODE_ENV === 'development',
lintOnSave: true, lintOnSave: true,
css: { css: {
loaderOptions: { loaderOptions: {
postcss: { postcss: {
plugins: [ plugins: [
...@@ -125,6 +127,15 @@ module.exports = { ...@@ -125,6 +127,15 @@ module.exports = {
} }
}, },
configureWebpack: { configureWebpack: {
plugins: [
new CompressionWebpackPlugin({
filename: '[path].gz[query]', // 提示compression-webpack-plugin@3.0.0的话asset改为filename
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
],
// provide the app's title in webpack's name field, so that // provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title. // it can be accessed in index.html to inject the correct title.
name: name, name: name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment