Skip to content
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

CLI: while importing some flags have pre-appended values #1679

Closed
snitin315 opened this issue Jul 11, 2020 · 9 comments · Fixed by #1695
Closed

CLI: while importing some flags have pre-appended values #1679

snitin315 opened this issue Jul 11, 2020 · 9 comments · Fixed by #1695
Projects

Comments

@snitin315
Copy link
Member

Bug report

While importing flags from core some flags are preappended with values , for example -

  • --module-no-parse
  • --module-no-parse-reset
  • --optimization-no-emit-on-errors

What is the current behavior?
These flags have pre appended values and seems we cant override .

Screenshot at 2020-07-11 14-03-34

If the current behavior is a bug, please provide the steps to reproduce.
Import flags and process them.

What is the expected behavior?

The flags should not have pre appended values.

Other relevant information:
webpack version:
Node.js version:
Operating System:
Additional tools:

@alexander-akait
Copy link
Member

@snitin315 I think it is bug on our side, can you provide more information? Why compilers is undefined?

@sokra
Copy link
Member

sokra commented Jul 13, 2020

The new CLI arguments system will fix that as it has --module-no-parse-reset for these cases.

@sokra sokra transferred this issue from webpack/webpack Jul 13, 2020
@snitin315
Copy link
Member Author

@snitin315 I think it is bug on our side, can you provide more information? Why compilers is undefined?

No idea 😕 , /cc @webpack/cli-team can anyone look into this? It is a major blocker for #1630

@alexander-akait
Copy link
Member

@snitin315 Can we try to test --optimization-no-emit-on-errors with pure setup without webpack-cli and check value?

@snitin315
Copy link
Member Author

@snitin315 Can we try to test --optimization-no-emit-on-errors with pure setup without webpack-cli and check value?

--optimization-no-emit-on-errors works fine on the webpack side. I don't know how but these 3 flags seem to be set to true by our arg-parser.
arg-parser should do this only if we have defaultValue: true for these which isn't the case here.

@snitin315
Copy link
Member Author

I think I found the bug, I can see defaultValue: true in parserInstance. Looking more into it.

Screenshot at 2020-07-16 20-28-38

@snitin315
Copy link
Member Author

I think it is a bug in commander.js, Actually, it sets defaultValue: true if the option starts with no-, but instead it is doing same for all options that include no-.
As mentioned in their docs - https://github.com/tj/commander.js/#other-option-types-negatable-boolean-and-flagvalue

You can specify a boolean option long name with a leading no- to set the option value to false when used. Defined alone this also makes the option true by default.

I will raise an issue there.

@alexander-akait
Copy link
Member

Good catch 👍

@snitin315
Copy link
Member Author

snitin315 commented Jul 17, 2020

I have sent a fix to commander.js, now we wait to merge and release.

@snitin315 snitin315 added this to In progress in GSoC 2021 Jul 20, 2020
GSoC 2021 automation moved this from In progress to Done (Phase 2) Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
GSoC 2021
  
Done (Phase 2)
Development

Successfully merging a pull request may close this issue.

3 participants