4.7.0 • Published 1 month ago

webpack-cli v4.7.0

Weekly downloads
5,094,270
License
MIT
Repository
github
Last release
1 month ago

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.
  migrate|m <config-path> [new-config-path]             Migrate a configuration to a new version.
  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.

webpack 4

  Options:
  --analyze                     It invokes webpack-bundle-analyzer plugin to get bundle information
  -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'.
  --env <value...>              Environment passed to the configuration when it is a function.
  --node-env <value>            Sets process.env.NODE_ENV to the specified value.
  --progress [value]            Print compilation progress during build.
  -j, --json [value]            Prints result as JSON or store it in a file.
  -d, --devtool <value>         Determine source maps to use.
  --no-devtool                  Do not generate source maps.
  --entry <value...>            The entry point(s) of your application e.g. ./src/main.js.
  -h, --hot [value]             Enables Hot Module Replacement
  --no-hot                      Disables Hot Module Replacement
  --mode <value>                Defines the mode to pass to webpack.
  --name <value>                Name of the configuration. Used when loading multiple configurations.
  -o, --output-path <value>     Output location of the file generated by webpack e.g. ./dist/.
  --prefetch <value>            Prefetch this request
  --stats [value]               It instructs webpack on how to treat the stats e.g. verbose.
  --no-stats                    Disable stats output.
  -t, --target <value...>       Sets the build target e.g. node.
  -w, --watch                   Watch for files changes.
  --no-watch                    Do not watch for file changes.
  --watch-options-stdin         Stop watching when stdin stream has ended.
  --no-watch-options-stdin      Do not stop watching when stdin stream has ended.

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.

webpack 5

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

Exit codes and their meanings

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

CLI Environment Variables

Environment VariableDescription
WEBPACK_CLI_SKIP_IMPORT_LOCALwhen true it will skip using the local instance of webpack-cli.
WEBPACK_CLI_FORCE_LOAD_ESM_CONFIGwhen true it will force load the ESM config.
WEBPACK_PACKAGEUse a custom webpack version in CLI.
WEBPACK_CLI_HELP_WIDTHUse custom width for help output.

Configuration Environment Variables

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

Environment VariableDescription
WEBPACK_SERVEtrue if serve\|s is being used.
WEBPACK_BUILDtrue if build\|bundle\|b is being used.
WEBPACK_WATCHtrue if --watch\|watch\|w is being used.

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

@vdjurdjevic/generator-react-appzzz-utilsftdr-sample@crushen/javascript-sdk-testproem-ui-developtmx-ui-demouniverse-test@joelcox22/boilerplatereact-img-pickerreact-image-uploadvideojs-plugin-markers@liuhaomin/builder-webpackheigouheima-lzbheima-tfgrilsgoogledriveapi-sach@asep.setiawan/react-kitzero-lucky@boris47/electron-webpackplafform-scriptslistner-resize-pagewebpackappformewebpacknumberstestversionreact-spinntertsemap-visualize@pofore/scriptgrav-plugin-webpackerhui-vue-uihui-webslider-helper-componentsdfocommonlibnetleak-vue-flash-messagemobilelivedesignsystemreactps_ccms_loginspa-build-coretrs-vue-clisv-uiwebpack-bootstrap-sassxdf-ntzsbpsdk@cubous/cors@cubous/pagination@wingsuit-designsystem/dsreact-shared-textmpaas-mtracker-base-test-1mpaas-mtracker-test-1muil-tempcreate-form-page-romakonn11@zeropack/zeropackmy-webpack-testnpm-rainbowreact-baremintry745653qtfcvfdddhelloworlddffetry845653qtfcvfdddhelloworlddffetry945653qtfcvfdddhelloworlddffe@seasketch-sls-geoprocessing/packaging@tenjo/webpack-config@s-isabella/scripts-frontend@darkhm/essence-constructor-scriptsvue-frame-gwwwwdevtoolsreact-eipobjcoliderhow-are-youjingyou-grouphandywebpackgatsby-starter-emulsify-drupal@c4co/react-helpers@jframe/ioc@plarin/build-configs@aleciambarella/ckeditor5-printlyralee-test@plarintest/build-configsscreen-spec-mdreact-cahooksreact-gl-custom-boilerplate-v1react-gl-custom-boilerplate-v2uni-tabbar-holdzxloaclstorageopinion-pollskywalking-clientatf-ui@modevel/cli@rock-kit/ui-scriptslipemat-js-boilerplatelibrary-chen2019magento2-reactdne-react-starterflask_react@enginite/elmnesiact2eigen-gojstenjo-webpack-configskillbox_npm_button_countyoyo_williammuil-2cost-model-systemglobal-loading-trasitionglobal-loading-transitionwww-mgsoftech
4.7.0

1 month ago

4.6.0

3 months ago

4.5.0

4 months ago

4.4.0

5 months ago

4.3.1

5 months ago

4.3.0

6 months ago

4.2.0

7 months ago

4.1.0

8 months ago

4.0.0

8 months ago

4.0.0-rc.1

8 months ago

4.0.0-rc.0

9 months ago

4.0.0-beta.9

9 months ago

3.3.12

12 months ago

4.0.0-beta.8

1 year ago

4.0.0-beta.7

1 year ago

4.0.0-beta.6

1 year ago

3.3.11

1 year ago

4.0.0-beta.3

1 year ago

4.0.0-beta.2

1 year ago

4.0.0-beta.1

2 years ago

4.0.0-beta.0

2 years ago

3.3.10

2 years ago

3.3.9

2 years ago

3.3.8

2 years ago

3.3.7

2 years ago

3.3.6

2 years ago

4.0.0-alpha-5

2 years ago

3.3.5

2 years ago

3.3.4

2 years ago

3.3.3

2 years ago

3.3.2

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

3.2.3

2 years ago

3.2.2

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

4.0.0-alpha-4

2 years ago

4.0.0-alpha-3

2 years ago

4.0.0-alpha-2

2 years ago

4.0.0-alpha-1

2 years ago

4.0.0-alpha

2 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.8

3 years ago

3.0.7

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.15

3 years ago

2.0.14

3 years ago

2.0.13

3 years ago

2.0.12

3 years ago

2.0.11

3 years ago

2.0.10

3 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.5.3

3 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.8

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.0.0

6 years ago