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

Consider providing a small inline CLI #6628

Closed
billyjanitsch opened this issue Mar 1, 2018 · 11 comments
Closed

Consider providing a small inline CLI #6628

billyjanitsch opened this issue Mar 1, 2018 · 11 comments

Comments

@billyjanitsch
Copy link
Member

Do you want to request a feature or report a bug?

Feature.

If this is a feature request, what is motivation or use case for changing the behavior?

webpack-cli does a lot of neat things, but it's huge, has a huge dependency list, and I don't personally need any of its features other than a tiny CLI that takes args and passes them to a webpack compiler. It's also annoying to have to remember to install an additional dependency for each web project.

Would you consider providing an extremely minimal CLI within the webpack package itself, which simply parsed args and sent them to a webpack instance? Everyone would still be free to use webpack-cli if they want/need, but no one would be forced to install an extremely large tool just to call webpack from the command line.

@bebraw
Copy link
Contributor

bebraw commented Mar 1, 2018

Yeah, agreed. A tiny CLI that can literally just build a project would cover most of the bases.

@montogeek
Copy link
Member

This should be moved to https://github.com/webpack/webpack-cli repo

@alexander-akait
Copy link
Member

alexander-akait commented Mar 1, 2018

I don't thing this is good idea. @billyjanitsch why webpack-cli is huge for you? It is only dev deps and don't affect on production build

@HillLiu
Copy link

HillLiu commented Mar 1, 2018

What is your expected with tiny cli?

You could have a simple cli use node.

such as vim webpack.js

import webpack from 'webpack';

webpack({your webpack configs}, ()=>{/*callback after end*/});

and run with

node ./webpack.js

@billyjanitsch
Copy link
Member Author

@montogeek no, this is specifically a request for webpack to include this outside of webpack-cli.

@evilebottnawi I wasn't saying that it makes my build huge, just that it's a huge package: 66mb of dependencies, including 2 transient dependencies on deprecated packages, and a transient dependency with a postinstall script, resulting in a slow install time.

That's a lot of weight to introduce to every user's dev environment when most web projects already use webpack-dev-server or webpack-serve for development and just need an extremely simple CLI to tell webpack to generate their production build, like @bebraw said.

@HillLiu I know that I can write such a CLI myself, but since it's so small, I'm asking whether it could be included in webpack so that it doesn't have to be duplicated across every project. I am happy to PR it.

(Btw, webpack-cli can easily be used as a one-off tool for chores like initialization and migration without depending on it by running e.g. npx webpack-cli init.)

@eknkc
Copy link

eknkc commented Mar 8, 2018

I agree with @billyjanitsch on this. Decided not to upgrade to webpack@4 just yet because installing webpack-cli installs half of the npm registry with it.

A small scope cli interface for webpack compiler should be included by default.

@garygreen
Copy link

garygreen commented Mar 9, 2018

I tell you who else would appreciate this.. @TheLarkInn https://www.twitch.tv/videos/232732984?t=00h44m06s

it's the cli.

🤣

@billyjanitsch
Copy link
Member Author

@sokra @TheLarkInn has this received enough attention for you to consider it?

@montogeek
Copy link
Member

@billyjanitsch You might like this https://www.npmjs.com/package/zeropack

@billyjanitsch
Copy link
Member Author

@montogeek thanks for the link but that seems to be an opinionated wrapper around webpack, including dependencies on loaders, etc. I don't want to make webpack simpler or change the way it behaves. I just want to invoke it via CLI (ideally without installing additional tooling).

@alexander-akait
Copy link
Member

alexander-akait commented May 6, 2018

Thanks everyone, released https://github.com/webpack-contrib/webpack-command

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

No branches or pull requests

7 participants