Skip to content

Commit cc9c9d0

Browse files
committed
fix: don't override process variable in DefinePlugin configuration
Following the warning on https://webpack.js.org/plugins/define-plugin/: > When defining values for process prefer > `'process.env.NODE_ENV': JSON.stringify('production')` over > `process: { env: { NODE_ENV: JSON.stringify('production') } }`. > Using the latter will overwrite the process object which can break > compatibility with some modules that expect other values on the > process object to be defined.
1 parent 8c2752a commit cc9c9d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/plugins/define.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const applyOptionsCallback = require('../utils/apply-options-callback');
2121
*/
2222
module.exports = function(plugins, webpackConfig) {
2323
const definePluginOptions = {
24-
'process.env': {
25-
NODE_ENV: webpackConfig.isProduction() ? '"production"' : '"development"'
26-
}
24+
'process.env.NODE_ENV': webpackConfig.isProduction()
25+
? '"production"'
26+
: '"development"',
2727
};
2828

2929
plugins.push({

0 commit comments

Comments
 (0)