feat(webpack): upgrade terser-webpack-plugin to v2 (#6398)

This commit is contained in:
Xin Du (Clark) 2019-09-18 14:59:54 +01:00 committed by Pooya Parsa
parent 622bd9989c
commit 7f57d83355
3 changed files with 19 additions and 17 deletions

View File

@ -37,7 +37,7 @@
"postcss-url": "^8.0.0",
"std-env": "^2.2.1",
"style-resources-loader": "^1.2.1",
"terser-webpack-plugin": "^1.4.1",
"terser-webpack-plugin": "^2.0.1",
"thread-loader": "^2.1.3",
"time-fix-plugin": "^2.0.6",
"url-loader": "^2.1.0",

View File

@ -190,19 +190,15 @@ export default class WebpackBaseConfig {
if (terser) {
minimizer.push(
new TerserWebpackPlugin(Object.assign({
parallel: true,
cache,
sourceMap: this.devtool && /source-?map/.test(this.devtool),
extractComments: {
condition: 'some',
filename: 'LICENSES'
},
terserOptions: {
compress: {
ecma: this.isModern ? 6 : undefined
},
output: {
comments: /^\**!|@preserve|@license|@cc_on/
},
mangle: {
reserved: reservedVueTags
}
@ -460,14 +456,6 @@ export default class WebpackBaseConfig {
// Clone deep avoid leaking config between Client and Server
const extendedConfig = cloneDeep(this.extendConfig(config))
const { optimization } = extendedConfig
// Todo remove in nuxt 3 in favor of devtool config property or https://webpack.js.org/plugins/source-map-dev-tool-plugin
if (optimization && optimization.minimizer && extendedConfig.devtool) {
const terser = optimization.minimizer.find(p => p instanceof TerserWebpackPlugin)
if (terser) {
terser.options.sourceMap = /source-?map/.test(extendedConfig.devtool)
}
}
return extendedConfig
}

View File

@ -10103,7 +10103,7 @@ schema-utils@^1.0.0:
ajv-errors "^1.0.0"
ajv-keywords "^3.1.0"
schema-utils@^2.0.0:
schema-utils@^2.0.0, schema-utils@^2.2.0:
version "2.2.0"
resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-2.2.0.tgz#48a065ce219e0cacf4631473159037b2c1ae82da"
integrity sha512-5EwsCNhfFTZvUreQhx/4vVQpJ/lnCAkgoIHLhSpp4ZirE+4hzFvdJi0FMub6hxbFVBJYSpeVVmon+2e7uEGRrA==
@ -10865,7 +10865,21 @@ terser-webpack-plugin@^1.4.1:
webpack-sources "^1.4.0"
worker-farm "^1.7.0"
terser@^4.1.2:
terser-webpack-plugin@^2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.0.1.tgz#5e69a187133472174ef2fb51afc76a0f0a7b1d13"
integrity sha512-DXx8f7080P2dgW9Ydd7MUon81AL+GkGr9prfQRf+rH06dRrgCGIvtT7q73JRm2UzmjKeJGtro9O8zwL2y2udag==
dependencies:
cacache "^12.0.3"
find-cache-dir "^3.0.0"
jest-worker "^24.9.0"
schema-utils "^2.2.0"
serialize-javascript "^2.1.0"
source-map "^0.6.1"
terser "^4.2.1"
webpack-sources "^1.4.3"
terser@^4.1.2, terser@^4.2.1:
version "4.3.1"
resolved "https://registry.npmjs.org/terser/-/terser-4.3.1.tgz#09820bcb3398299c4b48d9a86aefc65127d0ed65"
integrity sha512-pnzH6dnFEsR2aa2SJaKb1uSCl3QmIsJ8dEkj0Fky+2AwMMcC9doMqLOQIH6wVTEKaVfKVvLSk5qxPBEZT9mywg==
@ -11633,7 +11647,7 @@ webpack-node-externals@^1.7.2:
resolved "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-1.7.2.tgz#6e1ee79ac67c070402ba700ef033a9b8d52ac4e3"
integrity sha512-ajerHZ+BJKeCLviLUUmnyd5B4RavLF76uv3cs6KNuO8W+HuQaEs0y0L7o40NQxdPy5w0pcv8Ew7yPUAQG0UdCg==
webpack-sources@^1.0.1, webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1:
webpack-sources@^1.0.1, webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3:
version "1.4.3"
resolved "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"
integrity sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==