Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for npm run build #4111

Closed
ndao opened this issue Mar 5, 2018 · 4 comments
Closed

Documentation for npm run build #4111

ndao opened this issue Mar 5, 2018 · 4 comments

Comments

@ndao
Copy link

ndao commented Mar 5, 2018

Googling around I find articles like these talking about using.env file when npm run build. However, I don't see any official documentation for that on this repo.

https://medium.com/@tacomanator/environments-with-create-react-app-7b645312c09d
https://serverless-stack.com/chapters/environments-in-create-react-app.html

So if I have 3 .env files: .env, .env.test, .env.production, what is the proper/official way to specify a .env file when npm run build?

@ndao
Copy link
Author

ndao commented Mar 7, 2018

@ashutoshrishi im not quite finding where it it's saying run npm build with .env.test file for example?

@iansu
Copy link
Contributor

iansu commented Mar 8, 2018

You don't specify the env file manually. The settings in .env are the base config that is used by all scripts. The build script automatically uses the .env.production to add/override any settings from the base config. The test scripts uses .env.test in a similar way.

If you are looking to build for multiple environments (like qa, staging, production, etc.) then the instructions in this PR might help: #4117

@Timer
Copy link
Contributor

Timer commented Apr 15, 2018

PR #4117 has been merged.

@Timer Timer closed this as completed Apr 15, 2018
@lock lock bot locked and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants