From 6ae24537448d4308c13a7bc87e3e19183a29f037 Mon Sep 17 00:00:00 2001 From: Zephraph Date: Tue, 20 Jun 2017 08:23:37 -0400 Subject: [PATCH] docs(plugins): warning about overwriting process via DefinePlugin (#1308) See these issues for references: https://github.com/egoist/poi/pull/193 https://github.com/chentsulin/electron-react-boilerplate/pull/245/files Basically using something like the below example will break the process object compatibility that webpack includes. This just gives a warning about that. ```javascript new webpack.DefinePlugin({ process: { env: { NODE_ENV: JSON.stringify('production') } } }) ``` --- content/plugins/define-plugin.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/plugins/define-plugin.md b/content/plugins/define-plugin.md index c520400060fd..46e026b6aebd 100644 --- a/content/plugins/define-plugin.md +++ b/content/plugins/define-plugin.md @@ -83,6 +83,8 @@ new webpack.DefinePlugin({ }) ``` +W> 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. + ## Service URLs