Skip to content

Commit cbdb63b

Browse files
committed
add a comment about NODE_ENV value set to 'production' during build step
facebook#790 (comment)
1 parent 21fe19a commit cbdb63b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/react-scripts/template/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ default you will have `NODE_ENV` defined for you, and any other environment vari
604604
**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.
605605

606606
>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).
607+
> Also note that during build for deployment (`npm run build`), `NODE_ENV` will be hard-set to `'production'`.
607608
608609
These environment variables will be defined for you on `process.env`. For example, having an environment
609610
variable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`, in addition

0 commit comments

Comments
 (0)