Skip to content

Commit

Permalink
Clarify variables overwriting/priority in env.md
Browse files Browse the repository at this point in the history
This is meant to fix parcel-bundler#1013
  • Loading branch information
mrcoles authored Apr 13, 2023
1 parent 1e12d3a commit 7eb667d
Showing 1 changed file with 1 addition and 0 deletions.
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.

0 comments on commit 7eb667d

Please sign in to comment.