-
-
Notifications
You must be signed in to change notification settings - Fork 601
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
Variables passed to --env
with an empty value are incorrectly parsed
#3284
Comments
PR welcome |
@benjaminblack @alexander-akait this is a duplicate of #2642 and was fixed in #2643. We also have test cases for this: webpack-cli/test/build/config/type/function-with-env/function-with-env.test.js Lines 120 to 148 in 6075c63
|
But yes I feel if it ends with |
I'm not invoking Webpack through the terminal, I'm doing it through package.json. With this script:
The result is a property of With this:
The result is a property of No matter which variation I try, I can't get a property of |
Expected, because you have But |
Describe the bug
When passing env vars to webpack cli using
--env
, if the value of the variable passed is empty, then the resulting variable name and value is parsed incorrectly. As an example,webpack --env TEST=""
results in the followingenv
:What is the current behavior?
Empty variables passed to
--env
like--env VAR=""
or--env VAR=$NOT_DEFINED
result in theenv
object containing property names likeVAR=
with the valuetrue
.To Reproduce
Minimal webpack.config.js demonstrating behavior:
Steps to reproduce the behavior:
Expected behavior
Empty variables could be represented as one of
null
,undefined
, or""
, but certainly should not betrue
, and the property name should not include the=
.Screenshots
N/A
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationAdditional context
None
The text was updated successfully, but these errors were encountered: