Consider providing a small inline CLI

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


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.

Author: Fantashit

3 thoughts on “Consider providing a small inline CLI

  1. 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
  2. @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.)

  3. 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.

Comments are closed.