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

Clarify variables overwriting/priority in env.md #1079

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
1 change: 1 addition & 0 deletions src/i18n/en/docs/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Notably:

- `NODE_ENV` defaults to `development`.
- `.env.local` is not loaded when `NODE_ENV=test` since [tests should produce the same results for everyone](https://github.com/parcel-bundler/parcel/blob/28df546a2249b6aac1e529dd629f506ba6b0a4bb/src/utils/env.js#L9)
- When multiple .env files are present, they are loaded in the above order such that variables are overwritten and merged with the last file taking priority.
- Sometimes introducing a new .env file will not work immediately. Try deleting the .cache/ directory in this case.
- Accessing the `process.env` object directly is [not supported](https://github.com/parcel-bundler/parcel/issues/2299#issuecomment-439768971), but accessing specific variables on it like `process.env.API_KEY` will provide the expected value.
- Use the built-in `process` Node.js global, i.e. don't do `import process from "process"`, because it will not work. If you use TypeScript, you probably want to install `@types/node` for it to compile.