In the Webpack Production Documentation, one recommendation is to instantiate the object with a configuration variable for process.env.NODE_ENV, with the following recommended code:
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': JSON.stringify('production')
+ })
Why JSON.stringify('production')
and not just merely 'production'
?
Found the answer elsewhere in the webpack docs.
According to the define-plugin docs, you must supply a string with quotes embedded.
T> Note that because the plugin does a direct text replacement, the value given to it must include actual quotes inside of the string itself. Typically, this is done either with either alternate quotes, such as '"production"', or by using JSON.stringify('production').
Thanks TheIncorrigible1 for the Monday banter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With