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

webpack-cli info being run when not desired #1648

Closed
knagaitsev opened this issue Jun 24, 2020 · 3 comments · Fixed by #1650
Closed

webpack-cli info being run when not desired #1648

knagaitsev opened this issue Jun 24, 2020 · 3 comments · Fixed by #1650
Assignees

Comments

@knagaitsev
Copy link
Contributor

Describe the bug

I was trying to run webpack-cli serve with the logging flag set to info like this: webpack-cli serve --client-logging info. It seems that the info string was identified, and instead of running webpack-cli serve it just outputted system information like it would with webpack-cli info. Since info is a valid option for logging, we need to do more than just check that there is an info string in the argv.

To Reproduce

Put info as an option for something in a way that is valid, and the CLI will end up running webpack-cli info.

Expected behavior

webpack-cli info should not be run in certain cases

@alexander-akait
Copy link
Member

/cc @webpack/cli-team High priority

@jamesgeorge007
Copy link
Member

jamesgeorge007 commented Jun 25, 2020

This seems to be happening because info comes before serve in cli-flag definition.
webpack serve --client-log-level info
The present way of parsing commands picks info over serve.

const isCommandUsed = (commands) =>
commands.find((cmd) => {
return process.argv.includes(cmd.name) || process.argv.includes(cmd.alias);
});

@alexander-akait
Copy link
Member

We should rewrite it, using process.argv.includes is not safe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants