Webpack CLI provides numerous flags to customize the build process, output, optimization, and more.Documentation Index
Fetch the complete documentation index at: https://docs.webpack.js.org/llms.txt
Use this file to discover all available pages before exploring further.
Entry and Output
Entry point(s) for the bundle.
Output directory for all build files.
Filename template for entry chunks.
Public URL of the output directory when referenced in a browser.
Clean the output directory before emit. Default:
falseMode and Environment
Build mode. Sets defaults and
process.env.NODE_ENV.Values: development | production | noneEnvironment variables passed to config function.
Sets
process.env.NODE_ENV to the specified value.Configuration
Path to webpack configuration file.
Name of the configuration to use (for multi-config exports).
Merge two or more configurations.
Development
Watch files for changes and rebuild. Default:
falseStop watching when stdin stream ends.
Source map generation method.
Enable Hot Module Replacement. Default:
falseOptimization
Minimize the output. Default:
true in production mode.Enable module concatenation (scope hoisting).
Create a separate chunk for the webpack runtime.
Enable/disable code splitting.
Module Resolution
Create aliases for module imports.
Extensions to resolve.
Directories to search for modules.
Performance
Show performance hints.Values:
warning | error | falseMax size (in bytes) for entrypoint assets.
Max size (in bytes) for individual assets.
Stats and Output
Stats output preset.Presets:
none | errors-only | errors-warnings | minimal | normal | verbose | detailedShow details for errors.
Show compilation progress percentage.
Output stats as JSON. Optionally specify output file path.
Enable/disable colors in console output.
Target and Platform
Build target environment.Common values:
web | node | async-node | electron-main | electron-rendererCache
Enable/disable caching.
Cache type.Values:
memory | filesystemAnalyze and Debug
Generate bundle analysis.
Capture timing information for each module.
Abort compilation on first error.
DevServer Options
These flags are available when usingwebpack serve:
Port number for dev server. Default:
8080Host to use. Default:
localhostOpen browser. Optionally specify browser name or page path.
Directory to serve static files from.
Enable gzip compression.
Enable HTTPS.
Enable HTTP/2.
Utility Flags
Display help information.
Display webpack version.
Prevent output from being displayed in stdout.
Negating Boolean Flags
Boolean flags can be negated by prefixing withno-:
Flag Priority
When the same option is specified multiple times, the last value takes precedence:See Also
- CLI Commands - Available webpack commands
- Configuration - Configuration file options
- Environment Variables - Using environment variables