Awesome
<div align="center"> <a href="https://github.com/webpack/webpack-cli"> <img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg"> </a> </div> <h1 align="center">webpack CLI</h1> <p align="center"> The official Command Line Interface of webpack </p> <br>Table of Contents
- Introduction
- Supported arguments and commands
- Packages
- Getting started
- Exit codes and their meanings
- Contributing and Internal Documentation
- Funding
Introduction
Webpack CLI provides the interface of options webpack uses in its configuration file. The CLI options override options passed in the configuration file.
The CLI provides a rich set of commands that helps you develop your application faster.
How to install
If you have followed the Getting Started guide of webpack then webpack CLI is already installed!
Otherwise npm install --save-dev webpack-cli
, yarn add webpack-cli --dev
or pnpm add --D webpack-cli
will install it.
Supported arguments and commands
Get to know what are the available commands and arguments here.
Packages
We organize webpack CLI as a multi-package repository using lerna. The main CLI logic using options, resides in packages/webpack-cli
, while commands supported by the CLI, has dedicated subfolders in the folder packages
.
A summary of supported commands is described below.
Commands
Supporting developers is an important task for webpack CLI. Thus, webpack CLI provides different commands for many common tasks.
build|bundle|b [entries...] [options]
- Run webpack (default command, can be omitted).configtest|t [config-path]
- Validate a webpack configuration.help|h [command] [option]
- Display help for commands and options.init|create|new|c|n [generation-path] [options]
- Create a new webpack project.info|i [options]
- Returns information related to the local environment.plugin|p [output-path] [options]
- Initiate new plugin project.loader|l [output-path] [options]
- Initiate new loader project.serve|server|s [entries...] [options]
- Use webpack with a development server that provides live reloading.version|v [commands...]
- Output the version number ofwebpack
,webpack-cli
,webpack-dev-server
, and commands.watch|w [entries...] [options]
- Run webpack and watch for files changes.
Getting started
If you have followed the 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 you want to create a fresh webpack project, the init
command will guide you through setting up a project. Run the command as stated below.
npm i webpack-cli @webpack-cli/init
npx webpack-cli init
You will then be prompted for some questions about which features you want to use, such as scss
, typescript
, PWA
support or other features.
Exit codes and their meanings
Exit Code | Description |
---|---|
0 | Success |
1 | Errors from webpack |
2 | Configuration/options problem or an internal error |
Contributing and Internal Documentation
The webpack family welcomes any contributor, small or big. We are happy to elaborate, guide you through the source code and find issues you might want to work on! To get started have a look at our contribution documentation.
Funding
If you like webpack, please consider donating through Open Collective to help us keep the project relevant.
Code of Conduct
Guidelines to how the webpack organization expects you to behave is documented under Code of Conduct