From 9ddb4d4a78bde6ecdd7bf87c4beffb910b4d51d0 Mon Sep 17 00:00:00 2001 From: Christopher Monsanto Date: Sat, 5 Jul 2014 20:50:00 -0400 Subject: [PATCH] Add a note about production mode for npm installs. --- docs/downloads.md | 2 ++ npm-react/README.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/downloads.md b/docs/downloads.md index 0888d99f41..769c6b6ec9 100644 --- a/docs/downloads.md +++ b/docs/downloads.md @@ -76,6 +76,8 @@ React.renderComponent(...); If you'd like to use any [add-ons](/react/docs/addons.html), use `var React = require('react/addons');` instead. +**Note:** by default, React will be in development mode. To use React in production mode, set the environment variable `NODE_ENV` to `production`. For use in node, this is sufficient; if you are using browserify, the [envify](https://github.com/hughsk/envify) transform is needed to make use of environment variables. A minifier that performs dead-code elimination such as [UglifyJS](https://github.com/mishoo/UglifyJS2) is recommended to completely remove the extra code present in development mode. + ## Bower ```sh diff --git a/npm-react/README.md b/npm-react/README.md index e77fe6f0d9..b893636f4e 100644 --- a/npm-react/README.md +++ b/npm-react/README.md @@ -5,6 +5,9 @@ without also requiring the JSX transformer. This is especially useful for cases want to [`browserify`](https://github.com/substack/node-browserify) your module using `React`. +**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. + +To use React in production mode, set the environment variable `NODE_ENV` to `production`. For use in node, this is sufficient; if you are using browserify, the [envify](https://github.com/hughsk/envify) transform is needed to make use of environment variables. A minifier that performs dead-code elimination such as [UglifyJS](https://github.com/mishoo/UglifyJS2) is recommended to completely remove the extra code present in development mode. ## Example Usage