企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
**webpack-cli** [[git repo]](https://github.com/webpack/webpack-cli) webpack CLI provides a flexible set of commands for developers to increase speed when setting up a custom webpack project. As of webpack v4, webpack is not expecting a configuration file, but often developers want to create a more custom webpack configuration based on their use-cases and needs. webpack CLI addresses these needs by providing a set of tools to improve the setup of custom webpack configuration. [TOC] ------ ## Getting started When you have followed the [Getting Started](https://webpack.js.org/guides/getting-started/) guide of webpack then webpack CLI is already installed! Otherwise, you would need to install webpack CLI and the packages you want to use. If we want to use the `init` command to create a new `webpack.config.js` configuration file: ~~~shell npm i webpack-cli @webpack-cli/init npx webpack-cli init ~~~ You will be prompted for some questions about what how you want to generate your config file when running the`init`command so webpack CLI can provide the best fitting configuration. ## Commands Supporting developers is an important task for webpack CLI. Thus, webpack CLI provides different commands for many common tasks. * [`webpack-cli init`](https://github.com/webpack/webpack-cli/blob/next/packages/init/README.md#webpack-cli-init)\- Create a new webpack configuration. * [`webpack-cli info`](https://github.com/webpack/webpack-cli/blob/next/packages/info/README.md#webpack-cli-info)\- Returns information related to the local environment. * [`webpack-cli migrate`](https://github.com/webpack/webpack-cli/blob/next/packages/migrate/README.md#webpack-cli-migrate)\- Migrate project from one version to another. * [`webpack-cli generate-plugin`](https://github.com/webpack/webpack-cli/blob/next/packages/generate-plugin/README.md#webpack-cli-generate-plugin)\- Initiate new plugin project. * [`webpack-cli generate-loader`](https://github.com/webpack/webpack-cli/blob/next/packages/generate-loader/README.md#webpack-cli-generate-loader)\- Initiate new loader project. * [`webpack-cli serve`](https://github.com/webpack/webpack-cli/blob/next/packages/serve/README.md#webpack-cli-serve)\- Use webpack with a development server that provides live reloading. ## Utilities The project also has several utility packages which are used by other commands * [`utils`](https://github.com/webpack/webpack-cli/blob/next/packages/utils/README.md)\- Several utilities used across webpack-cli. * [`generators`](https://github.com/webpack/webpack-cli/blob/next/packages/generators/README.md)\- Contains all webpack-cli related yeoman generators. * [`webpack-scaffold`](https://github.com/webpack/webpack-cli/blob/next/packages/webpack-scaffold/README.md)\- Utilities to create a webpack scaffold.