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

打包压缩

parent 047fb8fb
......@@ -14,6 +14,8 @@
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
},
"dependencies": {
"crypto-js": "4.1.1",
"compression-webpack-plugin": "^1.1.12",
"dsbridge": "^3.1.4",
"@riophae/vue-treeselect": "^0.4.0",
"axios": "0.18.1",
......
......@@ -14,6 +14,9 @@ function resolve(dir) {
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,
// use administrator privileges to execute the command line.
// For example, Mac: sudo npm run
......@@ -52,7 +55,6 @@ module.exports = {
// lintOnSave: process.env.NODE_ENV === 'development',
lintOnSave: true,
css: {
loaderOptions: {
postcss: {
plugins: [
......@@ -125,6 +127,15 @@ module.exports = {
}
},
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
// it can be accessed in index.html to inject the correct title.
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