Skip to content

Commit adba1ad

Browse files
committed
Adds NODE_ENV emulation to Webpack configs for apps
1 parent ba2b483 commit adba1ad

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

config/webpack/app-development.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = function configFactory(ops) {
3838
'process.env': {
3939
BABEL_ENV: JSON.stringify('development'),
4040
DEV_TOOLS: JSON.stringify(true),
41+
NODE_ENV: JSON.stringify('development'),
4142
},
4243
}),
4344
new webpack.HotModuleReplacementPlugin(),

config/webpack/app-production.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module.exports = function configFactory(ops) {
3636
new webpack.DefinePlugin({
3737
'process.env': {
3838
BABEL_ENV: JSON.stringify('production'),
39+
NODE_ENV: JSON.stringify('production'),
3940
},
4041
}),
4142

docs/webpack-config.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ mutation of the config object.
114114
- [`webpack-hot-middleware/client?reload=true`](https://github.com/glenjamin/webpack-hot-middleware)
115115
- Emulates the following environment variables:
116116
- **`BABEL_ENV`** — It is set to *development* to inform any
117-
interested code that it is running in dev mode.
117+
interested code that it is running in dev mode;
118118
- **`DEV_TOOLS`** — It is set to *true* to signal the code that
119119
Redux dev tools should be enabled;
120+
- **`NODE_ENV`** — It is set to *development*.
120121
- Adds the following plugins:
121122
- [HotModuleReplacementPlugin](https://webpack.js.org/plugins/hot-module-replacement-plugin/);
122123
- [NoEmitOnErrorsPlugin](https://webpack.js.org/plugins/no-emit-on-errors-plugin/);
@@ -128,7 +129,8 @@ mutation of the config object.
128129
it differs from that in the following:
129130
- *production* Babel environment is enforced;
130131
- Emulates the following environment variables:
131-
- **`BABEL_ENV`** — It is set to *production*.
132+
- **`BABEL_ENV`** — It is set to *production*;
133+
- **`NODE_ENV`** — It is set to *production*.
132134
- Adds the following plugins:
133135
- [OptimizeCssAssetsPlugin](https://www.npmjs.com/package/optimize-css-assets-webpack-plugin);
134136
- [UglifyJsPlugin](https://webpack.js.org/plugins/uglifyjs-webpack-plugin/).

0 commit comments

Comments
 (0)