-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[ENHANCEMENT] Implement --env-file
option in npm-run-script
#7069
Comments
There’s no need; set NODE_OPTIONS to contain that node option. |
thanks! |
Based on @ljharb's comment that it should work with just setting NODE_OPTIONS I expected method 1 and 2 to work, but it only worked with method 3.
Another method I expected to work but didn't:
The method that ended up working for me, thank you meduzen in nodejs/node#49514
In webpack.config.js I have two console logs: |
@pereorga @ljharb Did |
@ljharb can this be reopened? As per comments above, this is not an option. In latest node LTS (20.11.1) and current (21.7.1) you get
Also see
Now that |
up |
Would love to see this |
up 👍 |
It can be useful to run a single npm script both locally and in CI/CD, where the CI/CD environment variables are injected automatically, while local variables are loaded from the .env file:
Now you can run it locally: `npm run --env-file=.env test:db" while in CI/CD you would use a built-in mechanism for passing environment variables to scripts and run it simply with "npm run test:db". |
See equivalent Node.js option in https://nodejs.org/dist/latest-v20.x/docs/api/cli.html#--env-fileconfig
Related: nodejs/node#49514
The text was updated successfully, but these errors were encountered: