Skip to content

Commit 57c998f

Browse files
committed
Update of Webpack config: emulation of BABEL_ENV var instead of NODE_ENV
1 parent 50dab3f commit 57c998f

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Topcoder React Utils Changelog
22

3+
### v0.2.0
4+
- Webpack configs for apps updated to emulate `process.env.BABEL_ENV` instead of
5+
`process.env.NODE_ENV`. The original intent behind emulation of that constant
6+
was to distinguish development and production bundles during the runtime; in
7+
our code depending on this package it is `BABEL_ENV` allows to distinguish
8+
the builds, while `NODE_ENV` serve to switch between dev and prod APIs to be
9+
used during the runtime.
10+
311
### v0.1.0
412
The first release of the package. In general, everything is set up, we are going
513
to move in difference stuff, without changing created package structure.

config/webpack/app-development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ module.exports = function configFactory(ops) {
3636
plugins: [
3737
new webpack.DefinePlugin({
3838
'process.env': {
39+
BABEL_ENV: JSON.stringify('development'),
3940
DEV_TOOLS: JSON.stringify(true),
40-
NODE_ENV: JSON.stringify('development'),
4141
},
4242
}),
4343
new webpack.HotModuleReplacementPlugin(),

config/webpack/app-production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = function configFactory(ops) {
3535
plugins: [
3636
new webpack.DefinePlugin({
3737
'process.env': {
38-
NODE_ENV: JSON.stringify('production'),
38+
BABEL_ENV: JSON.stringify('production'),
3939
},
4040
}),
4141

docs/webpack-config.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ mutation of the config object.
113113
- [`react-hot-loader/patch`](https://github.com/gaearon/react-hot-loader)
114114
- [`webpack-hot-middleware/client?reload=true`](https://github.com/glenjamin/webpack-hot-middleware)
115115
- Emulates the following environment variables:
116-
- `DEV_TOOLS` — It is set to *true* to signal the code that
117-
Redux dev tools should be enabled;
118-
- `NODE_ENV` — It is set to *development* to inform any
116+
- **`BABEL_ENV`** — It is set to *development* to inform any
119117
interested code that it is running in dev mode.
118+
- **`DEV_TOOLS`** — It is set to *true* to signal the code that
119+
Redux dev tools should be enabled;
120120
- Adds the following plugins:
121121
- [HotModuleReplacementPlugin](https://webpack.js.org/plugins/hot-module-replacement-plugin/);
122122
- [NoEmitOnErrorsPlugin](https://webpack.js.org/plugins/no-emit-on-errors-plugin/);
@@ -128,7 +128,7 @@ mutation of the config object.
128128
it differs from that in the following:
129129
- *production* Babel environment is enforced;
130130
- Emulates the following environment variables:
131-
- `NODE_ENV` — It is set to *production*.
131+
- **`BABEL_ENV`** — It is set to *production*.
132132
- Adds the following plugins:
133133
- [OptimizeCssAssetsPlugin](https://www.npmjs.com/package/optimize-css-assets-webpack-plugin);
134134
- [UglifyJsPlugin](https://webpack.js.org/plugins/uglifyjs-webpack-plugin/).

0 commit comments

Comments
 (0)