Basic Configuration
webpack.config.js
Output Options
The output directory as an absolute path (required).Default:
path.resolve(process.cwd(), 'dist')Public URL of the output directory when referenced in a browser.Default:
'auto'Name of non-entry chunk files.Default:
'[id].js' or derived from output.filenameFilename template for asset modules.Default:
'[hash][ext][query]'Clean the output directory before emit.Default:
falseFilename Templates
Templates can use these substitutions:[name]- Module name[id]- Module identifier[hash]- Module hash[contenthash]- Hash of the content[chunkhash]- Hash of the chunk content[fullhash]- Full hash of the compilation[ext]- File extension (includes.)[query]- Query string (includes?)[base]- Base filename[path]- File path[file]- Filename with extension
Advanced Options
Chunk Loading
Chunk Loading
Hashing
Hashing
Module Output
Module Output
Library Output
Library Output
Expose the output as a library.
Type of library.Options:
'var', 'module', 'assign', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'amd', 'umd', 'jsonp', 'system'Name of the library.
Specify which export to expose.
Cross-Origin Loading
Cross-Origin Loading
Source Maps
Source Maps
Hot Module Replacement
Hot Module Replacement
CSS Output
CSS Output
Other Options
Other Options
Expression for the global object.Default:
'self' (web), 'global' (Node.js)Unique name to avoid conflicts between multiple webpack runtimes.
Check if files changed before writing to filesystem.Default:
trueInclude path info in bundles.Default:
true in development, false in productionCommon Patterns
Production Build with Cache Busting
webpack.config.js
Development with Source Maps
webpack.config.js
CDN Deployment
webpack.config.js
Library Output
webpack.config.js