GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - webpack/webpack-cli: Webpack's Command Line Interface

BranchesTags
Open more actions menu

Latest commit

 

History

4,203 Commits
4,203 Commits

Folders and files

NameName
Last commit message
Last commit date
.changeset
.changeset
 
 
.devcontainer
.devcontainer
 
 
.github
.github
 
 
.husky
.husky
 
 
packages
packages
 
 
scripts
scripts
 
 
smoketests
smoketests
 
 
test
test
 
 
.c8rc.json
.c8rc.json
 
 
.codecov.yml
.codecov.yml
 
 
.cspell.json
.cspell.json
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.prettierignore
.prettierignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
OPTIONS.md
OPTIONS.md
 
 
README.md
README.md
 
 
SERVE-OPTIONS-v4.md
SERVE-OPTIONS-v4.md
 
 
SERVE-OPTIONS-v5.md
SERVE-OPTIONS-v5.md
 
 
SERVE-OPTIONS-v6.md
SERVE-OPTIONS-v6.md
 
 
eslint.config.mjs
eslint.config.mjs
 
 
jest.config.js
jest.config.js
 
 
lint-staged.config.js
lint-staged.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
prettier.config.js
prettier.config.js
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

webpack CLI

The official Command Line Interface of webpack


npm Build Status codecov Install Size GitHub Discussions Discord

Table of Contents

  • Introduction
    • How to install
  • Supported arguments and commands
  • Packages
    • Commands
  • Getting started
  • Shell completion
  • 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

The main CLI logic using options, resides in packages/webpack-cli.

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).
  • complete [shell] - Print a shell completion script, see Shell completion.
  • configtest|t [config-path] - Validate a webpack configuration.
  • help|h [command] [option] - Display help for commands and options.
  • info|i [options] - Returns information related to the local environment.
  • serve|server|s [entries...] [options] - Use webpack with a development server that provides live reloading.
  • version|v [commands...] - Output the version number of webpack, 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 run the command as stated below:

npx create-webpack-app 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.

Shell completion

Commands, their options and the values those options accept can be completed in zsh, bash, fish and powershell. The completions are read from webpack's own schema, so they cover whatever your webpack and webpack-dev-server versions support.

Completion is served by @bomb.sh/tab, which is optional and not installed with webpack-cli:

npm install --save-dev @bomb.sh/tab

Then load the script for your shell:

# zsh
echo 'source <(webpack complete zsh)' >> ~/.zshrc

# bash
echo 'source <(webpack complete bash)' >> ~/.bashrc

# fish
webpack complete fish > ~/.config/fish/completions/webpack.fish

# powershell
webpack complete powershell > ~/.webpack-completion.ps1
echo '. ~/.webpack-completion.ps1' >> $PROFILE

Once the shell is restarted, Tab completes commands, their aliases, options and option values:

webpack b<Tab>              # webpack build
webpack build --mode=<Tab>  # development, production, none
webpack serve --his<Tab>    # webpack serve --history-api-fallback

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

About

Webpack's Command Line Interface

webpack.js.org/api/cli

Topics

cliscaffoldwebpack

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

2.6k stars

Watchers

45 watching

Forks

680 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.