webpack-cli/packages/webpack-cli/README.md at next · coderjojo/webpack-cli

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


Available Commands

  init      Initialize a new webpack configuration
  migrate   Migrate a configuration to a new version
  loader    Scaffold a loader repository
  plugin    Scaffold a plugin repository
  info      Outputs information about your system and dependencies
  serve     Run the webpack Dev Server

Options

  --entry string           The entry point of your application.
  -c, --config string       Provide path to a webpack configuration file
  -m, --merge string       Merge a configuration file using webpack-merge
  --progress               Print compilation progress during build
  --silent                 Disable any output that webpack makes
  --help                   Outputs list of supported flags
  --defaults               Allow webpack to set defaults aggresively
  -o, --output string      Output location of the file generated by webpack
  --plugin string          Load a given plugin
  -g, --global string[]    Declares and exposes a global variable
  -t, --target string      Sets the build target
  -w, --watch              Watch for files changes
  -h, --hot                Enables Hot Module Replacement
  -s, --sourcemap string   Determine source maps to use
  --prefetch string        Prefetch this request
  -j, --json               Prints result as JSON
  --standard               Prints standard output
  -d, --dev                Run development build
  -p, --prod               Run production build
  --mode string            Defines the mode to pass to webpack
  --version                Get current version
  --node-args string[]     NodeJS flags

Defaults

TODO: explain defaults