-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[QUESTION] How can I unset env variable when run npm script? #680
Comments
you can't, unless webpack allows you to do it. |
In other words, if you want to call a script with a passthrough arg, the script can't already have defined that arg. |
@ljharb Got it, Thanks for answering. |
This was referenced Feb 11, 2024
This was referenced Feb 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What / Why
I have some npm scripts. Some of them use env variables. For example (just example):
So, for now, when I call
npm start
env.noSourceMaps = trueBut, how can I unset that variable when run npm start?
If I run
npm run -- --env.noSourceMaps=false
I gotenv.noSourceMaps = [true, 'false']
If I run
npm run -- --env.noSourceMaps
I gotenv.noSourceMaps = [true, true]
If I run
npm run -- --env.noSourceMaps=
I gotenv.noSourceMaps = [true, '']
But I want env.noSourceMaps = false or undefined
And I do not want to reverse logic (I mean, i don't want to use it as "start": "webpack --watch" and call it as
npm start
ornpm start -- --env.noSouceMaps
or"start": "webpack --watch", "start:noMaps": "webpack --watch --env.noSourceMaps"
)The text was updated successfully, but these errors were encountered: