压缩组件更改
Former-commit-id: 67784b20be1d6a4a63842015e708ac454dd14568 [formerly 67784b20be1d6a4a63842015e708ac454dd14568 [formerly 67784b20be1d6a4a63842015e708ac454dd14568 [formerly 67784b20be1d6a4a63842015e708ac454dd14568 [formerly 3646835614f2c1d40fab4cfb185251ea1e574118 [formerly c68574ccc2d7a95e5cdf60fb85af920e6c45b6ac]]]]] Former-commit-id: 655afa184632daf053c98ebbbd8e61cded846076 Former-commit-id: a8397ecd340645700ec2bc4ad8288b46085241fa Former-commit-id: 4ae63a6755397d5782a830119ecd0dfd7eae0e2a [formerly bff40ea0ea2d9c7cab5b79d34f4fed83983f3299] Former-commit-id: 6e60539fe5a215b6e76d3ea4fa8eb0026c029cbb Former-commit-id: 84ca1d313018bce355d37d71140289ed334fef6c Former-commit-id: 4486639b1b14810898df42cd77197fb760afa381 Former-commit-id: a396d7040212875694953fb2a14b5d20583f53b4 Former-commit-id: b2bcba97702e8e7d6bc72e34861a629f79e7d96b
This commit is contained in:
parent
b794c1462b
commit
525b8838d5
|
|
@ -68,7 +68,6 @@
|
|||
"sass-loader": "^7.1.0",
|
||||
"svg-sprite-loader": "^4.1.6",
|
||||
"text-loader": "0.0.1",
|
||||
"uglifyjs-webpack-plugin": "^2.1.3",
|
||||
"vue-cli-plugin-i18n": "^0.6.0",
|
||||
"vue-template-compiler": "^2.6.10",
|
||||
"webpack-theme-color-replacer": "^1.2.5"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||
const VueFilenameInjector = require('./tools/vue-filename-injector')
|
||||
|
||||
const ThemeColorReplacer = require('webpack-theme-color-replacer')
|
||||
|
|
@ -29,21 +28,14 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
},
|
||||
// node_modules 需要babel成es5的包
|
||||
transpileDependencies: [
|
||||
'webpack-theme-color-replacer'
|
||||
],
|
||||
configureWebpack: {
|
||||
plugins: [
|
||||
new ThemeColorReplacer({
|
||||
fileName: 'css/theme-colors.[contenthash:8].css',
|
||||
matchColors: [
|
||||
...forElementUI.getElementUISeries(process.env.VUE_APP_ELEMENT_COLOR) // Element-ui主色系列
|
||||
],
|
||||
externalCssFiles: [ './node_modules/element-ui/lib/theme-chalk/index.css' ], // optional, String or string array. Set external css files (such as cdn css) to extract colors.
|
||||
changeSelector: forElementUI.changeSelector
|
||||
})
|
||||
]
|
||||
configureWebpack: config => {
|
||||
// 非开发环境
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
|
||||
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
|
||||
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
|
||||
config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
|
||||
}
|
||||
},
|
||||
// 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js
|
||||
chainWebpack: config => {
|
||||
|
|
@ -59,6 +51,16 @@ module.exports = {
|
|||
// 解决 cli3 热更新失效 https://github.com/vuejs/vue-cli/issues/1559
|
||||
config.resolve
|
||||
.symlinks(true)
|
||||
config
|
||||
.plugin('theme-color-replacer')
|
||||
.use(ThemeColorReplacer, [{
|
||||
fileName: 'css/theme-colors.[contenthash:8].css',
|
||||
matchColors: [
|
||||
...forElementUI.getElementUISeries(process.env.VUE_APP_ELEMENT_COLOR) // Element-ui主色系列
|
||||
],
|
||||
externalCssFiles: [ './node_modules/element-ui/lib/theme-chalk/index.css' ], // optional, String or string array. Set external css files (such as cdn css) to extract colors.
|
||||
changeSelector: forElementUI.changeSelector
|
||||
}])
|
||||
config
|
||||
// 开发环境
|
||||
.when(process.env.NODE_ENV === 'development',
|
||||
|
|
@ -71,23 +73,6 @@ module.exports = {
|
|||
propName: process.env.VUE_APP_SOURCE_VIEWER_PROP_NAME
|
||||
})
|
||||
)
|
||||
// 非开发环境
|
||||
.when(process.env.NODE_ENV !== 'development', config => {
|
||||
config.optimization
|
||||
.minimizer([
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
// 移除 console
|
||||
// 其它优化选项 https://segmentfault.com/a/1190000010874406
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
pure_funcs: ['console.log']
|
||||
}
|
||||
}
|
||||
})
|
||||
])
|
||||
})
|
||||
// markdown
|
||||
config.module
|
||||
.rule('md')
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
b90ddad21ccad6e1a280693fba504af4a91c6fd3
|
||||
166cefa60c1a43bece188f7803ae15ee9b265caf
|
||||
Loading…
Reference in New Issue