Improve documentation for using React with Webpack
Fixes #5679
Vitor Balocco committed
Dec 17, 2015 at 17:22 UTC
a3d6553a304d42794363efeefbf50e8e6883424e
1 file changed
+10
-1
docs/docs/getting-started.md
+10
-1
@@ -34,7 +34,7 @@ $ npm install --save react react-dom babelify babel-preset-react
34
$ browserify -t [ babelify --presets [ react ] ] main.js -o bundle.js
35
```
36
37
-To install React DOM and build your bundle with webpack:
37
+To install React DOM and build your bundle with webpack:
38
39
```sh
40
$ npm install --save react react-dom babel-preset-react
@@ -45,6 +45,15 @@ $ webpack
45
>
46
> If you are using ES2015, you will want to also use the `babel-preset-es2015` package.
47
48
+**Note:** by default, React will be in development mode, which is slower, and not advised for production. To use React in production mode, set the environment variable `NODE_ENV` to `production` (using envify or webpack's DefinePlugin). For example:
49
+
50
+```js
51
+new webpack.DefinePlugin({
52
+ "process.env": {
53
+ NODE_ENV: JSON.stringify("production")
54
+ }
55
+});
56
+```
57
58
## Quick Start Without npm
59