Former-commit-id: 856ffa599cba540197ec393598942809a3925e72
Former-commit-id: 460b39488f790611ddcff9b9632998a7e7dc6f88
Former-commit-id: 686bc89bc486bd217edc7066ee8dfc8ad24c0bd0
Former-commit-id: 4700849c0fec1e54ffb2bfa23e911b06ef0e32be [formerly 2b43f432b96bc78b7714ac46135c168d8666353b]
Former-commit-id: 3e304a0514c9f0e0af71e8849d304d246b8811e2
Former-commit-id: dd95fa3d67c0220dce2844e48e19daa4d556e496
Former-commit-id: 765eec344db78fe509e57aaeaae8e8ed7b272a52
Former-commit-id: ceb73b8ba61f1645ccd5d89bbd585cc50c214011
Former-commit-id: 9c66c63cad2cbd448a4349e00495e2af8569b57d
This commit is contained in:
FairyEver
2019-12-12 20:09:31 +08:00
parent 9d360d4745
commit d383398250
3 changed files with 57 additions and 1 deletions

View File

@@ -1 +1 @@
975a87cbfa94ae0055fa5dbbf387398b44b8c8f0
d5b6db76fb2766c6c4500653fe9988f046835785

View File

@@ -64,10 +64,14 @@
"compression-webpack-plugin": "^3.0.1",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.2.2",
"html-webpack-plugin": "^3.2.0",
"inline-manifest-webpack-plugin": "^4.0.2",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"sass": "^1.21.0",
"sass-loader": "^7.1.0",
"svg-sprite-loader": "^4.1.6",
"text-loader": "0.0.1",
"uglifyjs-webpack-plugin": "^2.2.0",
"vue-cli-plugin-i18n": "^0.6.0",
"vue-template-compiler": "^2.6.10",
"webpack-theme-color-replacer": "^1.2.15"

View File

@@ -1,5 +1,11 @@
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin')
const VueFilenameInjector = require('@d2-projects/vue-filename-injector')
const ThemeColorReplacer = require('webpack-theme-color-replacer')
@@ -31,7 +37,53 @@ module.exports = {
}
},
configureWebpack: {
optimization: {
runtimeChunk: 'single',
minimizer: [
// 自定义js优化配置将会覆盖默认配置
new UglifyJsPlugin({
exclude: /\.min\.js$/, // 过滤掉以".min.js"结尾的文件,我们认为这个后缀本身就是已经压缩好的代码,没必要进行二次压缩
cache: true,
parallel: true, // 开启并行压缩充分利用cpu
sourceMap: false,
extractComments: false, // 移除注释
uglifyOptions: {
compress: {
unused: true,
drop_debugger: true
},
output: {
comments: false
},
warnings: false
}
}),
// 用于优化css文件
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessorOptions: {
safe: true,
autoprefixer: { disable: true },
mergeLonghand: false,
discardComments: {
removeAll: true // 移除注释
}
},
canPrint: true
})
]
},
plugins: [
// runtime 相关的代码嵌入 indexe.html
new HtmlWebpackPlugin({
title: 'fle-cli',
filename: 'index.html',
inject: true,
chunks: ['runtime', 'app'],
chunksSortMode: 'dependency',
minify: {/* */}
}),
new InlineManifestWebpackPlugin('runtime'),
// gzip
new CompressionWebpackPlugin({
filename: '[path].gz[query]',