Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Docs - Document multiple build environments via
  • Loading branch information
Jerry committed Mar 6, 2018
commit 86eda518d82757996e5ccbf7018a42ccb8dbbb9c
4 changes: 1 addition & 3 deletions packages/react-scripts/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ Applications are generally split between different environments such as staging,

- `REACT_APP_NODE_ENV=staging npm run build`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using NODE_ENV and REACT_APP_NODE_ENV for this example is potentially confusing. The similar names implies that there is some connection between them. The example we commonly use is something like REACT_APP_API_URL which is set to one value in .env.production or .env and then overridden for other environments.


When the environment variable is set you can do conditionals within your code:
When the environment variable is set you can then do conditionals within your code:

```js
if (process.env.REACT_APP_NODE_ENV === 'staging') {
Expand Down Expand Up @@ -2257,8 +2257,6 @@ Then run `npm run build:staging`

You may use `.env.production` as the fallback option in this case as `'production'` is the default `NODE_ENV`



### [Azure](https://azure.microsoft.com/)

See [this](https://medium.com/@to_pe/deploying-create-react-app-on-microsoft-azure-c0f6686a4321) blog post on how to deploy your React app to Microsoft Azure.
Expand Down