.env.local environment variables are not being picked up after upgrading from NX v18 to v19 #23362
Closed as not planned
Closed as not planned
Description
Current Behavior
Before I updated my project from NX v18 to v19, my environment variables e.g. NX_USE_MSW
in .env.local
would work perfectly fine. I could log it out. Now that I've updated to v19, it logs out as undefined
instead of the value I set it to.
When I move back to my branch with v18, everything works fine again.
Expected Behavior
I expect my environment variables to work when updating, or I expect a docs update on the migration required here.
GitHub Repo
No response
Steps to Reproduce
- Create a
.env.local
file at the root of the NX Project - Add a value there like
NX_SOME_KEY=SOME_VALUE
- Add a console log to
process.env["NX_SOME_KEY"]
- Serve your app
- It will log
undefined
, instead of the expected"SOME_VALUE"
Nx Report
Node : 20.12.0
OS : linux-arm64
npm : 10.5.0
nx : 19.0.3
@nx/js : 19.0.3
@nx/jest : 19.0.3
@nx/linter : 19.0.3
@nx/eslint : 19.0.3
@nx/workspace : 19.0.3
@nx/cypress : 19.0.3
@nx/devkit : 19.0.3
@nx/eslint-plugin : 19.0.3
@nx/playwright : 19.0.3
@nx/react : 19.0.3
@nx/storybook : 19.0.3
@nrwl/tao : 19.0.3
@nx/web : 19.0.3
@nx/webpack : 19.0.3
typescript : 5.4.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
Failure Logs
No response
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
I'm using module federation and running the project in a dev-container if that might have anything to do with it.
Activity