These types are not exported by webpack, but they are available to TypeScript consumers.
Advanced options for cleaning assets.
CompiledAliasOption[]Map<number, CompiledAliasOption[]>booleanbooleanOptions object as provided by the user.
require.amd
and
define.amd
. Or disable AMD support.booleanboolean | FileCacheOptions | MemoryCacheOptionsstringentry
option. If
output.pathinfo
is set, the included pathinfo is shortened to this directory.string[]string | false | { type: "css" | "javascript" | "all"; use: RawDevTool }[]boolean | DotenvPluginOptionsstring | string[] | EntryObject | (() => string | string[] | EntryObject | Promise<EntryStatic>)Experimentsstring | RegExp | ExternalItemObjectKnown & ExternalItemObjectUnknown | ((data: ExternalItemFunctionData, callback: (err?: Error | null, result?: string | boolean | string[] | ExternalItemValueObjectKnown & ExternalItemValueObjectUnknown) => void) => void) | ((data: ExternalItemFunctionData) => Promise<ExternalItemValue>) | ExternalItem[]output.libraryTarget
.ExternalsPresets"asset" | "module" | "asset-url" | "css-import" | "promise" | "global" | "import" | "this" | "var" | "commonjs" | "self" | "script" | "jsonp" | "assign" | "window" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "amd-async" | "umd" | "umd2" | "system" | "module-import" | "node-commonjs" | "css-url"(RegExp | { file?: RegExp; message?: RegExp; module?: RegExp } | ((warning: Error, compilation: Compilation) => boolean))[]InfrastructureLoggingLoader"development" | "none" | "production"ModuleOptionsNormalModuleFactory
).stringfalse | NodeOptionsOptimizationOutputoutput
options tell webpack how to write the compiled files to disk.numberfalse | PerformanceOptions(false | "" | 0 | WebpackPluginInstance | ((this: Compiler, compiler: Compiler) => void) | null | undefined)[]booleanstring | falsestring | falsestring | falserecordsPath
is used for
recordsInputPath
and
recordsOutputPath
if they left undefined.ResolveOptionsResolveOptionsSnapshotOptionsWebpackOptionsboolean | "none" | "verbose" | "summary" | "errors-only" | "errors-warnings" | "minimal" | "normal" | "detailed" | StatsOptionsbooleanbooleanWatchOptionsstringbooleanstringstring | nullRegExp | nullbooleanRawChunkGroupOptionsstringRegExp | nullstring | nullContextModeboolean | "strict"string[]0 | 2 | 1booleanstring[][] | nullfalse | RegExp | nullstringstringGenerator options for css modules.
Parser options for css modules.
"stylesheet" | "block-contents"style
attribute).boolean@custom-media
at-rules (file-local build-time substitution).boolean@custom-selector
at-rules (file-local build-time expansion to
:is(...)
)."link" | "text" | "css-style-sheet" | "style"boolean<link rel="preload" as="font">
for the primary
src
URL of each
@font-face
reachable from an HTML entry's initial CSS. Only the first URL per
@font-face
is preloaded (preloading every format would double-download). Off by default;
parser.css.urlHints
rules and per-URL magic comments still override the seeded defaults. Set
output.crossOriginLoading
so the preload matches the font's CORS fetch.boolean@import
at-rules handling.booleanbooleanurl()
/
image-set()
/
src()
/
image()
functions handling.UrlHintRule[]new URL(...)
, CSS
url(...)
, HTML
<img src>
/
<link href>
/
<script src>
).Options for Dotenv plugin.
string | falsestring[]No generator options are supported for this module type.
No parser options are supported for this module type.
[index: {string}]any
Generator options for html modules.
boolean | "inline".html
output file alongside the module's JavaScript export.
true
always emits the file;
false
never does;
"inline"
exposes the processed HTML for inline write-back (e.g.
<iframe srcdoc>
) without emitting a standalone file. When unset, extraction defaults to
true
for HTML modules used as compilation entries (HTML entry points) and
false
for HTML modules imported from JavaScript. Filenames follow
output.htmlFilename
/
output.htmlChunkFilename
.Parser options for html modules.
string"document"
(the default) parses a full page; any other value is the tag name of the context element to parse the source as that element's inner HTML (a fragment) — e.g.
"template"
for a neutral fragment, or
"tbody"
so context-sensitive tags like a bare
<tr>
/
<td>
are kept instead of dropped.boolean | ("..." | { attribute: string; filter?: (attributes: Map<string, string>, value: string) => boolean; tag?: string; type: false | "html" | "script" | "src" | "stylesheet" | "css-url" | "srcset" | "script-module" | "stylesheet-style" | "stylesheet-style-attribute" | "srcdoc" })[]<img src>
,
<link href>
,
<script src>
) as webpack dependencies.
true
(default) uses the built-in source list;
false
disables extraction entirely so attributes are left untouched and
<script src>
/
<link rel="modulepreload">
/
<link rel="stylesheet">
no longer become compilation entries; an array lets you customize which
tag
/
attribute
pairs are treated as URLs and how they are bundled. Use the string
"..."
inside the array to inline the defaults. Inline
<script>
and
<style>
bodies are always processed. Use
webpackIgnore
comments or
IgnorePlugin
to skip individual URLs.(source: string, context: HtmlTemplateContext) => string{ module, resource }
) and must return the html string to parse. Useful for compiling a templating language (Handlebars, EJS, Eta, …) to html so that URLs the template emits are still picked up as webpack dependencies. Runs synchronously.UrlHintRule[]new URL(...)
, CSS
url(...)
, HTML
<img src>
/
<link href>
/
<script src>
).A custom resource-hint <link> for output.html.resourceHints. Exactly one of href / chunk / entry names the target.
stringas
attribute (
script
,
style
,
font
, …); defaults to
script
for chunk/entry references.stringboolean | "use-credentials" | "anonymous"true
maps to
anonymous
.string"auto" | "high" | "low"fetchpriority
attribute. Emitted on
preload
/
modulepreload
and on
prefetch
(the spec now permits it there).stringpreconnect
origin, or an already-hashed asset).booleanoutput.html.integrity
by default; set
false
to opt this hint out.stringmedia
attribute."preload" | "prefetch" | "modulepreload" | "preconnect" | "dns-prefetch"rel
of the resource hint.stringtype
attribute (MIME type).Options for building http resources.
string | falsebooleanstringstringbooleanParser options for javascript modules.
require.amd
and
define.amd
. Or disable AMD support.booleanbooleanbooleanbooleancreateRequire
from "module"" and evaluating createRequire().boolean<link rel="preload" as="style">
for the CSS of every dynamically imported (
import()
) chunk, so the stylesheet fetches in parallel with the chunk's JavaScript instead of after it parses. Unlike
dynamicImportPreload
, the JavaScript itself is not preloaded.
true
uses the default order; a number sets the preload order.false | "auto" | "high" | "low""eager" | "weak" | "lazy" | "lazy-once"booleanfalse | "error" | "warn" | "auto"booleanbooleanstringbooleanbooleanfalse | "error" | "warn" | "auto"boolean | "preserve-unknown" | ImportMetaParserOptionsbooleanfalse | NodeOptions"strict" | "non-strict"(code: string, options: ParseOptions) => ParseResultstring[]false | "error" | "warn" | "auto"booleanbooleanbooleanbooleanbooleanbooleanfalse | "error" | "warn"booleanbooleanbooleanbooleanbooleanstringboolean | "relative"UrlHintRule[]new URL(...)
, CSS
url(...)
, HTML
<img src>
/
<link href>
/
<script src>
).booleanbooleanRegExpGenerator options for json modules.
booleanJSON.parse
when the JSON string is longer than 20 characters.Parser options for JSON modules.
numberexportInfo
.boolean(input: string) => string | number | boolean | Buffer<ArrayBufferLike> | JsonObjectFs | JsonValueFs[] | nullOptions for the default backend.
stringnumber | ListenOptions | ((server: ServerLazyCompilationBackend) => void)"http" | "https"ServerOptions<typeof IncomingMessage, typeof ServerResponse> | ServerOptions<typeof IncomingMessage, typeof ServerResponse> | (() => ServerLazyCompilationBackend)Options for compiling entrypoints and import()s only when they are accessed.
((compiler: Compiler, callback: (err: Error | null, backendApi?: BackendApi) => void) => void) | ((compiler: Compiler) => Promise<BackendApi>) | LazyCompilationDefaultBackendOptionsbooleanboolean[index: {string}]any
numberOptions object for node compatibility features.
boolean | "warn-mock" | "mock" | "node-module" | "eval-only"boolean | "warn-mock" | "mock" | "node-module" | "eval-only"boolean | "warn"Options for the generated HTML files.
<base>
element into the page
<head>
. A string sets
href
; an object sets both
href
and optionally
target
. Skipped if the HTML already contains a
<base>
element.boolean | { hashFunction?: "sha256" | "sha384" | "sha512"; nonce?: string; policy?: { [index: string]: string | string[] } }<meta http-equiv="Content-Security-Policy">
into every webpack-emitted HTML page.
false
(default) does nothing;
true
uses a strict baseline (
script-src 'self'
,
style-src 'self'
,
object-src 'none'
,
base-uri 'self'
) and appends a
sha256
hash of every inline
<script>
/
<style>
to
script-src
/
style-src
. An object customizes it. Skipped when the page already declares a CSP.string | boolean | { [index: string]: string | { color?: string; crossorigin?: "use-credentials" | "anonymous"; href: string; media?: string; sizes?: string; type?: string } | HtmlFaviconIcon[] } | ((name: string) => string | boolean | { [index: string]: string | HtmlFaviconIcon[] | { color?: string; crossorigin?: "use-credentials" | "anonymous"; href: string; media?: string; sizes?: string; type?: string } })false
(default) injects nothing;
true
injects the webpack logo; a string is a path to an icon; an object maps each
<link rel>
to an icon — a path string, an object with the icon
href
plus extra link attributes (
sizes
,
media
,
color
,
type
,
crossorigin
), or an array of these for multiple icons under the same
rel
(e.g. several
sizes
, or light/dark
media
variants); a function receives the page name and returns one of these. Every icon is emitted as a hashed asset.false | "body" | "head"<script>
/
<link>
tags.
"body"
(default;
"head"
with
output.module
) keeps them next to the entry tag — end of
<body>
on generated pages;
"head"
moves them into
<head>
;
false
suppresses sibling-chunk injection (entry tags and resource hints remain).<script>
/
<link>
tag.
true
inlines every chunk;
"script"
inlines only JavaScript,
"style"
only CSS; an array of
RegExp
patterns matches against the chunk name.integrity
attributes to injected
<script>
/
<link>
tags.
true
uses
['sha384']
; an array sets the hash algorithms; a function receives each referenced asset and returns the algorithms to use or
false
to skip it.string | false | { [index: string]: any } | ((name: string) => string | false | { [index: string]: any })false
(default) injects nothing. A string is a path to an existing
.webmanifest
file to link. An object is the manifest contents — serialized, emitted as a hashed
.webmanifest
and linked with
<link rel="manifest">
; its
icons
/
screenshots
src
paths resolve like any request and are emitted as hashed assets. A function receives the page name and returns one of these.<meta>
tags into the page
<head>
. Each key is the
name
attribute (or
"charset"
for a charset declaration); the value is the
content
string. Keys beginning with
og:
use the
property
attribute instead of
name
. A tag is skipped if the HTML already contains a meta with the same name."defer" | "auto" | "blocking"<script>
tags load.
auto
(default) emits a module script for ES module output and
defer
otherwise;
defer
forces a deferred script;
blocking
emits a plain blocking script.string<title>
of the generated HTML page. Skipped if the HTML already contains a
<title>
element.booleanbooleanbooleanecmaVersionbooleanCommentJavascriptParser[]booleanrange
lazily and skip acorn's location/range trackingbooleanbooleanauto
, let the parser downgrade module->script in place instead of re-parsingboolean"module" | "script"[index: {string}]any
Configuration object for web performance recommendations.
false | "error" | "warning"numbernumberReturns location of targetPath relative to rootPath.
Full resource-hint configuration.
boolean | "preload" | "prefetch" | "none" | HtmlResourceHintWebpackOptions[] | ((context: { compilation: Compilation; defaultHints: (HtmlResourceHintHtmlEntryDependency & { hostChunks: string[] })[]; entryName: string; entrypoint: Entrypoint; hostType: "html" | "js" }) => HtmlResourceHintHtmlEntryDependency[])true
auto-emits
<link rel="modulepreload">
(ESM output) or
<link rel="preload" as="script">
(classic) for each of the entry's initial dependency chunks;
"prefetch"
uses
<link rel="prefetch">
;
"preload"
is an alias of
true
;
false
disables chunk hints (URL-asset hints from magic comments /
urlHints
still fire);
"none"
is a hard off switch (no
<link>
anywhere, empty stats / manifest); an array of
HtmlResourceHint
descriptors replaces the auto set; a function receives the auto
defaultHints
plus context (
entryName
,
entrypoint
,
hostType: "html" | "js"
,
compilation
) and returns the final list (replaces the removed
resolveDependencies
hook).stringstats.entrypoints[].resourceHints
) as an output asset at this path. Lets an SSR server inject the
<link>
tags itself without walking the chunk graph — webpack's analogue of Vite's
build.ssrManifest
. Empty when
initial
is
"none"
.boolean<script>
polyfill for
<link rel="modulepreload">
into extracted HTML pages. Defaults from the target's modulepreload support (
output.environment.modulePreload
) —
true
when the environment lacks native support,
false
when it has it. Set
false
to never inject (the
<link>
tags are still emitted but do nothing on browsers without support — useful under a strict CSP that forbids inline scripts).boolean<link rel="preconnect">
for the origin of a cross-origin
output.publicPath
(the origin bundles and assets are served from) into extracted HTML entries and the resource-hint stats / manifest. Mirrors
output.crossOriginLoading
. No-op when
publicPath
is relative or
"auto"
.UrlHintRule[]urlHints
of every parser (JavaScript
new URL(...)
, CSS
url(...)
, HTML
<img src>
/
<link href>
). Parser-scoped
module.parser.<type>.urlHints
rules and per-URL magic comments still override these.Options affecting how file system snapshots are created and validated.
string | false | TemplatePathFn<PathData> | nullbooleanbooleanstring | ((context: ModuleFilenameTemplateContext) => string)stringstring | false | nullbooleanstring | ((context: ModuleFilenameTemplateContext) => string)stringbooleanstringstringReturns location of targetPath relative to rootPath.
Returns location of targetPath relative to rootPath.
Options for the watcher.
string | false | { type: "css" | "javascript" | "all"; use: RawDevTool }[]Normalized webpack options object.
require.amd
and
define.amd
. Or disable AMD support.booleanCacheOptionsNormalizedstringentry
option. If
output.pathinfo
is set, the included pathinfo is shortened to this directory.string[]string | false | { type: "css" | "javascript" | "all"; use: RawDevTool }[]boolean | DotenvPluginOptionsEntryNormalizedExperimentsNormalizedExternalsoutput.libraryTarget
.ExternalsPresets"asset" | "module" | "asset-url" | "css-import" | "promise" | "global" | "import" | "this" | "var" | "commonjs" | "self" | "script" | "jsonp" | "assign" | "window" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "amd-async" | "umd" | "umd2" | "system" | "module-import" | "node-commonjs" | "css-url"((warning: Error, compilation: Compilation) => boolean)[]InfrastructureLoggingLoader"development" | "none" | "production"ModuleOptionsNormalizedNormalModuleFactory
).stringNodeWebpackOptionsOptimizationNormalizedOutputNormalizedoutput
options tell webpack how to write the compiled files to disk.numberfalse | PerformanceOptions(WebpackPluginInstance | ((this: Compiler, compiler: Compiler) => void))[]booleanstring | falsestring | falseResolveOptionsResolveOptionsSnapshotOptionsWebpackOptionsStatsValuebooleanbooleanWatchOptions(options: Partial<ResolveOptionsWithDependencyType>) => ResolverWithOptionsReadonlyArray<Configuration> & MultiCompilerOptionsfalse | NodeOptionsStreamOptions & { end?: number; fs?: null | CreateReadStreamFSImplementation }numbernull | CreateReadStreamFSImplementationWebpackOptionsNormalized & { context: string } & { infrastructureLogging: InfrastructureLoggingNormalizedWithDefaults } & { target: NonNullable<undefined | string | false | string[]> } & { output: OutputNormalizedWithDefaults } & { optimization: OptimizationNormalizedWithDefaults } & { devtool: NonNullable<undefined | string | false | { type: "css" | "all" | "javascript"; use: RawDevTool }[]> } & { stats: NonNullable<StatsValue> } & { node: NonNullable<NodeWebpackOptions> } & { profile: NonNullable<undefined | boolean> } & { parallelism: number } & { snapshot: SnapshotNormalizedWithDefaults } & { externalsPresets: ExternalsPresetsNormalizedWithDefaults } & { externalsType: NonNullable<undefined | "import" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system" | "amd-async" | "promise" | "module-import" | "script" | "node-commonjs" | "asset" | "asset-url" | "css-import" | "css-url"> } & { watch: NonNullable<undefined | boolean> } & { performance: NonNullable<undefined | false | PerformanceOptions> } & { recordsInputPath: NonNullable<undefined | string | false> } & { recordsOutputPath: NonNullable<undefined | string | false> } & { dotenv: NonNullable<undefined | boolean | DotenvPluginOptions> }stringInfrastructureLoggingNormalizedWithDefaultsNonNullable<undefined | string | false | string[]>OutputNormalizedWithDefaultsOptimizationNormalizedWithDefaultsNonNullable<undefined | string | false | { type: "css" | "all" | "javascript"; use: RawDevTool }[]>NonNullable<StatsValue>NonNullable<undefined | boolean>numberSnapshotNormalizedWithDefaultsExternalsPresetsNormalizedWithDefaultsNonNullable<undefined | "import" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system" | "amd-async" | "promise" | "module-import" | "script" | "node-commonjs" | "asset" | "asset-url" | "css-import" | "css-url">NonNullable<undefined | boolean>NonNullable<undefined | false | PerformanceOptions>NonNullable<undefined | string | false>NonNullable<undefined | string | false>NonNullable<undefined | boolean | DotenvPluginOptions>StreamOptions & { flush?: boolean; fs?: null | CreateWriteStreamFSImplementation }booleannull | CreateWriteStreamFSImplementation