webpack-cli
CLI for webpack & friends
Last updated 2 years ago by evilebottnawi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install webpack-cli 
SYNC missed versions from official npm registry.

webpack CLI

The official CLI of webpack

About

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.

How to install

When you have followed the Getting Started guide of webpack then webpack CLI is already installed!

Otherwise

npm install --save-dev webpack-cli

or

yarn add webpack-cli --dev

Supported arguments and commands

Usage

All interactions with webpack-cli are of the form

npx webpack-cli [command] [options]

If no command is specified then bundle command is used by default

Help Usage

To display basic commands and arguments -

npx webpack-cli --help

To display all supported commands and arguments -

npx webpack-cli --help=verbose

or

npx webpack-cli --help verbose

Available Commands

  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.
  info|i [options]                                      Outputs information about your system.
  init|create|new|c|n [generation-path] [options]       Initialize a new webpack project.
  loader|l [output-path] [options]                      Scaffold a loader.
  plugin|p [output-path] [options]                      Scaffold a plugin.
  serve|server|s [entries...] [options]                 Run the webpack dev server.
  version|v [commands...]                               Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
  watch|w [entries...] [options]                        Run webpack and watch for files changes.

Available Options

Options:
  -c, --config <value...>                          Provide path to a webpack configuration file e.g. ./webpack.config.js.
  --config-name <value...>                         Name of the configuration to use.
  -m, --merge                                      Merge two or more configurations using 'webpack-merge'.
  --disable-interpret                              Disable interpret for loading the config file.
  --env <value...>                                 Environment passed to the configuration when it is a function.
  --node-env <value>                               Sets process.env.NODE_ENV to the specified value.
  --define-process-env-node-env <value>            Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`)
  --analyze                                        It invokes webpack-bundle-analyzer plugin to get bundle information.
  --progress [value]                               Print compilation progress during build.
  -j, --json [value]                               Prints result as JSON or store it in a file.
  --fail-on-warnings                               Stop webpack-cli process with non-zero exit code on warnings from webpack
  -d, --devtool <value>                            A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
  --no-devtool                                     Negative 'devtool' option.
  --entry <value...>                               A module that is loaded upon startup. Only the last one is exported.
  --mode <value>                                   Enable production optimizations or development hints.
  --name <value>                                   Name of the configuration. Used when loading multiple configurations.
  -o, --output-path <value>                        The output directory as **absolute path** (required).
  --stats [value]                                  Stats options object or preset name.
  --no-stats                                       Negative 'stats' option.
  -t, --target <value...>                          Environment to build for. Environment to build for. An array of environments to build for all of them when possible.
  --no-target                                      Negative 'target' option.
  -w, --watch                                      Enter watch mode, which rebuilds on file change.
  --no-watch                                       Negative 'watch' option.
  --watch-options-stdin                            Stop watching when stdin stream has ended.
  --no-watch-options-stdin                         Negative 'watch-options-stdin' option.

Global options:
  --color                                          Enable colors on console.
  --no-color                                       Disable colors on console.
  -v, --version                                    Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
  -h, --help [verbose]                             Display help for commands and options.

Checkout OPTIONS.md to see list of all available options.

Exit codes and their meanings

Exit Code Description
0 Success
1 Errors from webpack
2 Configuration/options problem or an internal error

CLI Environment Variables

Environment Variable Description
WEBPACK_CLI_SKIP_IMPORT_LOCAL when true it will skip using the local instance of webpack-cli.
WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG when true it will force load the ESM config.
WEBPACK_PACKAGE Use a custom webpack version in CLI.
WEBPACK_DEV_SERVER_PACKAGE Use a custom webpack-dev-server version in CLI.
WEBPACK_CLI_HELP_WIDTH Use custom width for help output.

Configuration Environment Variables

You can use the following environment variables inside your webpack configuration:

Environment Variable Description
WEBPACK_SERVE true if serve\|s is being used.
WEBPACK_BUILD true if build\|bundle\|b is being used.
WEBPACK_WATCH true if --watch\|watch\|w is being used.

Checkout webpack.js.org for more detailed documentation of webpack-cli.

Current Tags

  • 4.0.0-alpha-5                                ...           4.0.0.0-alpha-5 (5 years ago)
  • 4.0.0-beta.9                                ...           beta (4 years ago)
  • 5.1.4                                ...           latest (2 years ago)
  • 4.0.0-rc.1                                ...           next (4 years ago)

123 Versions

  • 5.1.4                                ...           2 years ago
  • 5.1.3                                ...           2 years ago
  • 5.1.2                                ...           2 years ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           2 years ago
  • 5.0.2                                ...           2 years ago
  • 5.0.1                                ...           2 years ago
  • 5.0.0                                ...           2 years ago
  • 4.10.0                                ...           3 years ago
  • 4.9.2                                ...           3 years ago
  • 4.9.1                                ...           3 years ago
  • 4.9.0                                ...           3 years ago
  • 4.8.0                                ...           3 years ago
  • 4.7.2                                ...           4 years ago
  • 4.7.1                                ...           4 years ago
  • 4.7.0                                ...           4 years ago
  • 4.6.0                                ...           4 years ago
  • 4.5.0                                ...           4 years ago
  • 4.4.0                                ...           4 years ago
  • 4.3.1                                ...           4 years ago
  • 4.3.0                                ...           4 years ago
  • 4.2.0                                ...           4 years ago
  • 4.1.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 4.0.0-rc.1                                ...           4 years ago
  • 4.0.0-rc.0                                ...           4 years ago
  • 4.0.0-beta.9                                ...           4 years ago
  • 3.3.12                                ...           5 years ago
  • 4.0.0-beta.8                                ...           5 years ago
  • 4.0.0-beta.7                                ...           5 years ago
  • 4.0.0-beta.6                                ...           5 years ago
  • 3.3.11                                ...           5 years ago
  • 4.0.0-beta.3                                ...           5 years ago
  • 4.0.0-beta.2 [deprecated]           ...           5 years ago
  • 4.0.0-beta.1                                ...           5 years ago
  • 4.0.0-beta.0                                ...           5 years ago
  • 3.3.10                                ...           5 years ago
  • 3.3.9                                ...           5 years ago
  • 3.3.8                                ...           5 years ago
  • 3.3.7                                ...           5 years ago
  • 3.3.6                                ...           5 years ago
  • 4.0.0-alpha-5                                ...           5 years ago
  • 3.3.5                                ...           6 years ago
  • 3.3.4                                ...           6 years ago
  • 3.3.3                                ...           6 years ago
  • 3.3.2                                ...           6 years ago
  • 3.3.1                                ...           6 years ago
  • 3.3.0                                ...           6 years ago
  • 3.2.3                                ...           6 years ago
  • 3.2.2                                ...           6 years ago
  • 3.2.1                                ...           6 years ago
  • 3.2.0                                ...           6 years ago
  • 4.0.0-alpha-4                                ...           6 years ago
  • 4.0.0-alpha-3                                ...           6 years ago
  • 4.0.0-alpha-2                                ...           6 years ago
  • 4.0.0-alpha-1                                ...           6 years ago
  • 4.0.0-alpha                                ...           6 years ago
  • 3.1.2                                ...           6 years ago
  • 3.1.1                                ...           6 years ago
  • 3.1.0                                ...           6 years ago
  • 3.0.8                                ...           7 years ago
  • 3.0.7                                ...           7 years ago
  • 3.0.6                                ...           7 years ago
  • 3.0.5                                ...           7 years ago
  • 3.0.4                                ...           7 years ago
  • 3.0.3                                ...           7 years ago
  • 3.0.2                                ...           7 years ago
  • 3.0.1                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 2.1.5                                ...           7 years ago
  • 2.1.4                                ...           7 years ago
  • 0.0.8-development                                ...           7 years ago
  • 0.0.7-development                                ...           7 years ago
  • 0.0.6-development                                ...           7 years ago
  • 0.0.5-development                                ...           7 years ago
  • 0.0.4-development                                ...           7 years ago
  • 0.0.3-development                                ...           7 years ago
  • 0.0.2-development                                ...           7 years ago
  • 0.0.1-development                                ...           7 years ago
  • 0.0.0-development                                ...           7 years ago
  • 2.1.3                                ...           7 years ago
  • 2.1.2                                ...           7 years ago
  • 2.1.1                                ...           7 years ago
  • 2.1.0                                ...           7 years ago
  • 2.0.15                                ...           7 years ago
  • 2.0.14                                ...           7 years ago
  • 2.0.13                                ...           7 years ago
  • 2.0.12                                ...           7 years ago
  • 2.0.11                                ...           7 years ago
  • 2.0.10                                ...           7 years ago
  • 2.0.9                                ...           7 years ago
  • 2.0.8                                ...           7 years ago
  • 2.0.7                                ...           7 years ago
  • 2.0.6                                ...           7 years ago
  • 2.0.5                                ...           7 years ago
  • 2.0.4                                ...           7 years ago
  • 2.0.3                                ...           7 years ago
  • 2.0.2                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.5.3                                ...           7 years ago
  • 1.5.2                                ...           7 years ago
  • 1.5.1                                ...           7 years ago
  • 1.5.0                                ...           7 years ago
  • 1.4.8                                ...           7 years ago
  • 1.4.7                                ...           7 years ago
  • 1.4.6                                ...           7 years ago
  • 1.4.5                                ...           7 years ago
  • 1.4.4                                ...           7 years ago
  • 1.4.3                                ...           7 years ago
  • 1.4.2                                ...           7 years ago
  • 1.4.1                                ...           7 years ago
  • 1.4.0                                ...           7 years ago
  • 1.3.9                                ...           7 years ago
  • 1.3.8                                ...           7 years ago
  • 1.3.7                                ...           7 years ago
  • 1.3.5                                ...           7 years ago
  • 1.3.4                                ...           7 years ago
  • 1.3.3                                ...           8 years ago
  • 1.3.2                                ...           8 years ago
  • 1.3.1                                ...           8 years ago
  • 1.3.0                                ...           8 years ago
  • 1.0.0                                ...           10 years ago
Downloads
Total 180
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 5
Dependencies (13)
Dev Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE