Merge pull request #5686 from vitorbal/master
Improve documentation for using React with Webpack
This commit is contained in:
commit
f7850dd3d7
|
@ -34,7 +34,7 @@ $ npm install --save react react-dom babelify babel-preset-react
|
|||
$ browserify -t [ babelify --presets [ react ] ] main.js -o bundle.js
|
||||
```
|
||||
|
||||
To install React DOM and build your bundle with webpack:
|
||||
To install React DOM and build your bundle with webpack:
|
||||
|
||||
```sh
|
||||
$ npm install --save react react-dom babel-preset-react
|
||||
|
@ -45,6 +45,15 @@ $ webpack
|
|||
>
|
||||
> If you are using ES2015, you will want to also use the `babel-preset-es2015` package.
|
||||
|
||||
**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:
|
||||
|
||||
```js
|
||||
new webpack.DefinePlugin({
|
||||
"process.env": {
|
||||
NODE_ENV: JSON.stringify("production")
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Quick Start Without npm
|
||||
|
||||
|
|
Loading…
Reference in New Issue