Skip to content
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

Merged
merged 1 commit into from
Aug 4, 2021
Merged

webpack build fix #294

merged 1 commit into from
Aug 4, 2021

Conversation

e1adn
Copy link
Contributor

@e1adn e1adn commented Aug 4, 2021

No description provided.

@@ -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),
Copy link
Contributor Author

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.

Copy link
Contributor

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",
Copy link
Contributor Author

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

@e1adn e1adn requested a review from yaniv-li August 4, 2021 05:20
@@ -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';
Copy link
Contributor Author

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

Copy link
Contributor

@yaniv-li yaniv-li left a 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),
Copy link
Contributor

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.

@e1adn
Copy link
Contributor Author

e1adn commented Aug 4, 2021

@yaniv-li it never did .. arg.mode was never equal to 'production' . we only pass mode='development' not mod='production'

@e1adn e1adn merged commit 8b26352 into edge Aug 4, 2021
@e1adn e1adn deleted the webpack-prod-build-fix branch August 4, 2021 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants