Upgrade to webpack@4.26 (#5729)
* Upgrade terser-webpack-plugin * Upgrade webpack * Extract common terserPluginConfig
This commit is contained in:
parent
d43d305092
commit
44d661af67
2 changed files with 17 additions and 25 deletions
|
@ -100,22 +100,24 @@ function externalsConfig (dir, isServer, lambdas) {
|
|||
return externals
|
||||
}
|
||||
|
||||
function optimizationConfig ({dir, dev, isServer, totalPages, lambdas}) {
|
||||
function optimizationConfig ({ dir, dev, isServer, totalPages, lambdas }) {
|
||||
const terserPluginConfig = {
|
||||
parallel: true,
|
||||
sourceMap: false,
|
||||
cache: true,
|
||||
cacheKeys: (keys) => {
|
||||
// path changes per build because we add buildId
|
||||
// because the input is already hashed the path is not needed
|
||||
delete keys.path
|
||||
return keys
|
||||
}
|
||||
}
|
||||
|
||||
if (isServer && lambdas) {
|
||||
return {
|
||||
splitChunks: false,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
parallel: true,
|
||||
sourceMap: false,
|
||||
cache: true,
|
||||
cacheKeys: (keys) => {
|
||||
// path changes per build because we add buildId
|
||||
// because the input is already hashed the path is not needed
|
||||
delete keys.path
|
||||
return keys
|
||||
}
|
||||
})
|
||||
new TerserPlugin(terserPluginConfig)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -145,17 +147,7 @@ function optimizationConfig ({dir, dev, isServer, totalPages, lambdas}) {
|
|||
|
||||
// Terser is a better uglifier
|
||||
config.minimizer = [
|
||||
new TerserPlugin({
|
||||
parallel: true,
|
||||
sourceMap: false,
|
||||
cache: true,
|
||||
cacheKeys: (keys) => {
|
||||
// path changes per build because we add buildId
|
||||
// because the input is already hashed the path is not needed
|
||||
delete keys.path
|
||||
return keys
|
||||
}
|
||||
})
|
||||
new TerserPlugin(terserPluginConfig)
|
||||
]
|
||||
|
||||
// Only enabled in production
|
||||
|
|
|
@ -74,10 +74,10 @@
|
|||
"resolve": "1.5.0",
|
||||
"strip-ansi": "3.0.1",
|
||||
"styled-jsx": "3.1.1",
|
||||
"terser-webpack-plugin": "1.0.2",
|
||||
"terser-webpack-plugin": "1.1.0",
|
||||
"unfetch": "3.0.0",
|
||||
"url": "0.11.0",
|
||||
"webpack": "4.25.1",
|
||||
"webpack": "4.26.0",
|
||||
"webpack-dev-middleware": "3.4.0",
|
||||
"webpack-hot-middleware": "2.22.3",
|
||||
"webpack-sources": "1.2.0",
|
||||
|
|
Loading…
Reference in a new issue