* Upgrade terser-webpack-plugin

* Upgrade webpack

* Extract common terserPluginConfig
This commit is contained in:
Richard Park 2018-11-22 18:14:14 +09:00 committed by Tim Neutkens
parent d43d305092
commit 44d661af67
2 changed files with 17 additions and 25 deletions

View file

@ -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

View file

@ -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",