Options affecting the output of the compilation. output options tell webpack how to write the compiled files to disk.
stringAdd a container for define/require functions in the AMD module.
string | TemplatePathFn<PathDataModule>The filename of asset modules as relative path inside the 'output.path' directory.
booleanEnable/disable creating async chunks that are loaded on demand.
Add a comment in the UMD wrapper.
booleanAdd charset attribute for script tag.
string | TemplatePathFn<PathDataChunk>Specifies the filename template of output files of non-initial chunks on disk. You must not specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
string | falseThe format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), 'module' (ESM), but others might be added by plugins).
string | falseThe method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
stringThe global variable used by webpack for loading of chunks.
numberNumber of milliseconds before chunk request expires.
boolean | CleanOptionsClean the output directory before emit.
booleanCheck if to be emitted file already exists and have the same content before writing to output filesystem.
false | "use-credentials" | "anonymous"This option enables cross-origin loading of chunks.
string | TemplatePathFn<PathDataChunk>Specifies the filename template of non-initial output css files on disk. You must not specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
string | TemplatePathFn<PathDataChunk>Specifies the filename template of output css files on disk. You must not specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
string | ((context: ModuleFilenameTemplateContext) => string)Similar to output.devtoolModuleFilenameTemplate, but used in the case of duplicate module identifiers.
string | ((context: ModuleFilenameTemplateContext) => string)Filename template string of function for the sources array in a generated SourceMap.
stringModule namespace to use when interpolating filename template string for the sources array in a generated SourceMap. Defaults to output.library if not set. It's useful for avoiding runtime collisions in sourcemaps from multiple webpack projects built as libraries.
string[]List of chunk loading types enabled for use by entry points.
string[]List of library types enabled for use by entry points.
string[]List of wasm loading types enabled for use by entry points.
EnvironmentThe abilities of the environment where the webpack generated code should run.
string | TemplatePathFn<PathDataChunk>Specifies the filename of output files on disk. You must not specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
stringAn expression which is used to address the global object/scope in runtime code.
stringDigest types used for the hash.
numberNumber of chars which are used for the hash.
Algorithm used for generation the hash (see node.js crypto package).
stringAny string which is added to the hash to salt it.
stringThe filename of the Hot Update Chunks. They are inside the output.path directory.
stringThe global variable used by webpack for loading of hot update chunks.
stringThe filename of the Hot Update Main File. It is inside the 'output.path' directory.
boolean | OutputHtmlOptionsGenerate an HTML file for each non-HTML entrypoint with its JS and CSS output chunks injected. Can be overridden per entry via the entry descriptor html option.
string | TemplatePathFn<PathDataChunk>Specifies the filename template of non-initial output html files on disk. You must not specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
string | TemplatePathFn<PathDataChunk>Specifies the filename template of output html files on disk. You must not specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
booleanIgnore warnings in the browser.
booleanWrap javascript code into IIFE's to avoid leaking into global scope.
stringThe name of the native import() function (can be exchanged for a polyfill).
stringThe name of the native import.meta object (can be exchanged for a polyfill).
string | string[] | LibraryCustomUmdObject | LibraryOptionsMake the output files a library, exporting the exports of the entry point.
Specify which export should be exposed as library.
stringType of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
booleanOutput javascript files as module source type.
stringThe output directory as absolute path (required).
boolean | "verbose"Include comments with information about the modules.
string | TemplatePathFn<PathData>The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
boolean | "preload" | "prefetch" | "none" | ResourceHintsOptions | HtmlResourceHintWebpackOptions[] | ((context: { compilation: Compilation; defaultHints: (HtmlResourceHintHtmlEntryDependency & { hostChunks: string[] })[]; entryName: string; entrypoint: Entrypoint; hostType: "html" | "js" }) => HtmlResourceHintHtmlEntryDependency[])Resource-hint (<link rel="prefetch"> / <link rel="preload"> / <link rel="modulepreload"> / <link rel="preconnect">) emission for extracted HTML entries and URL-referenced assets. Accepts the initial-graph shorthand (boolean / "prefetch" / "preload" / "none" / HtmlResourceHint[] / function — equivalent to { initial: <value> }) or the full object form { initial, urlHints, preconnect, modulePreloadPolyfill, manifest }. initial defaults on for ESM output (output.module), where native import() would otherwise waterfall; classic output stays opt-in.
false | "module" | "text/javascript"This option enables loading async chunks via a custom script type, such as script type="module".
stringThe filename of the SourceMaps for the JavaScript files. They are inside the 'output.path' directory.
stringPrefixes every line of the source in the bundle with this string.
booleanHandles error in module loading correctly at a performance cost. This will handle module error compatible with the EcmaScript Modules spec.
booleanHandles exceptions in module loading correctly at a performance cost (Deprecated). This will handle module error compatible with the Node.js CommonJS way.
booleanEmit a runtime check that throws a 'MODULE_NOT_FOUND' error when a required module id is missing from the bundle.
string | true | TrustedTypesUse a Trusted Types policy to create urls for chunks. 'output.uniqueName' is used a default policy name. Passing a string sets a custom policy name.
booleanIf output.libraryTarget is set to umd and output.library is set, setting this to true will name the AMD module.
stringA unique name of the webpack build to avoid multiple webpack runtimes to conflict when using globals.
string | falseThe method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
booleanFall back to non-streaming WebAssembly instantiation when streaming compilation fails because the server does not serve .wasm files with the application/wasm MIME type.
stringThe filename of WebAssembly modules as relative path inside the 'output.path' directory.
string | TemplatePathFn<PathDataChunk>Specifies the filename template of non-initial output worker's files on disk. You must not specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
string | falseThe method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
stringWorker public path. Much like the public path, this sets the location where the worker script file is intended to be found. If not set, webpack will use the publicPath. Don't set this option unless your worker scripts are located at a different path from your other script files.
string | falseThe method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).