3 ms·
Production mode already defines NODE_ENV. [1] Your usage of DefinePlugin is redundant in that case. Any reason why you are defining it twice? [1]: https://webp
by jannes 9y ago
Production mode already defines NODE_ENV. [1] Your usage of DefinePlugin is redundant in that case. Any reason why you are defining it twice?
[1]: https://webpack.js.org/concepts/mode/ https://webpack.js.org/concepts/mode/
I think for beginners it's great to see what production mode actually does under the hood, but it shouldn't end up in the final config.
- timdorr 9y agoAlso, DefinePlugin is superseded by EnvironmentPlugin: https://webpack.js.org/plugins/environment-plugin/ https://webpack.js.org/plugins/environment-plugin/
- nobleach 9y agoInteresting. I was attempting to compile some bundles over the weekend and was noticing drastically larger chunk sizes. I realized this was because I had neglected to specify NODE_ENV=production, and my babel-loader was using my dev config (which leaves prop-types in the code). Based on your comment, and the above docs, I shouldn't be seeing what I'm seeing.
- rhinoceraptor 9y agoAre you using webpack 3? That change happened in February with webpack 4: https://github.com/webpack/webpack/releases/tag/v4.0.0 https://github.com/webpack/webpack/releases/tag/v4.0.0