-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack build fix #294
webpack build fix #294
Conversation
@@ -20,8 +22,8 @@ module.exports = (env, argv) => { | |||
filename: `[name]${lightFilenamePart}.js`, | |||
chunkFilename: `[id]-[chunkhash]${lightFilenamePart}.js` | |||
}, | |||
optimization: optimization(argv.mode), | |||
plugins: plugins(argv.mode) | |||
optimization: optimization(mode), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 'optimization' function never returned anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns the configuration only if the mode is production.
@@ -84,7 +84,7 @@ | |||
"shx": "^0.3.3", | |||
"snyk": "^1.653.0", | |||
"source-map-loader": "1.1.3", | |||
"terser-webpack-plugin": "^5.1.4", | |||
"terser-webpack-plugin": "^4.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise, get this error webpack-contrib/terser-webpack-plugin#335
@@ -10,7 +10,9 @@ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | |||
const TerserPlugin = require('terser-webpack-plugin'); | |||
|
|||
module.exports = (env, argv) => { | |||
lightFilenamePart = argv.mode === 'development' ? lightFilenamePart : lightFilenamePart + '.min'; | |||
const isDevelopment = argv.mode === 'development'; | |||
const mode = isDevelopment ? 'development' : 'production'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'argv.mode' can be undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks fine
@@ -20,8 +22,8 @@ module.exports = (env, argv) => { | |||
filename: `[name]${lightFilenamePart}.js`, | |||
chunkFilename: `[id]-[chunkhash]${lightFilenamePart}.js` | |||
}, | |||
optimization: optimization(argv.mode), | |||
plugins: plugins(argv.mode) | |||
optimization: optimization(mode), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns the configuration only if the mode is production.
@yaniv-li it never did .. arg.mode was never equal to 'production' . we only pass mode='development' not mod='production' |
No description provided.