Skip to content

Commit

Permalink
add a comment about NODE_ENV value set to 'production' during build step
Browse files Browse the repository at this point in the history
  • Loading branch information
mderazon committed Feb 23, 2017
1 parent 21fe19a commit cbdb63b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/react-scripts/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ default you will have `NODE_ENV` defined for you, and any other environment vari
**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them.

>Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527).
> Also note that during build for deployment (`npm run build`), `NODE_ENV` will be hard-set to `'production'`.
These environment variables will be defined for you on `process.env`. For example, having an environment
variable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`, in addition
Expand Down

0 comments on commit cbdb63b

Please sign in to comment.