* The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
*/
context?: string;
/**
* References to other configurations to depend on.
*/
dependencies?: string[];
/**
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
*/
experiments?: Experiments;
/**
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
* Enable production optimizations or development hints.
*/
mode?: "development" | "production" | "none";
/**
* Options affecting the normal modules (`NormalModuleFactory`).
*/
module?: ModuleOptions;
/**
* Name of the configuration. Used when loading multiple configurations.
*/
name?: string;
/**
* Include polyfills or mocks for various node stuff.
*/
node?: false | NodeOptions;
/**
* Enables/Disables integrated optimizations.
*/
optimization?: Optimization;
/**
* Options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.
*/
output?: Output;
/**
* The number of parallel processed modules in the compilation.
*/
parallelism?: number;
/**
* Configuration for web performance recommendations.
*/
performance?: false | PerformanceOptions;
/**
* Add additional plugins to the compiler.
*/
plugins?: (
| ((this: Compiler, compiler: Compiler) => void)
| WebpackPluginInstance
)[];
/**
* Capture timing information for each module.
*/
profile?: boolean;
/**
* Store compiler state to a json file.
*/
recordsInputPath?: string | false;
/**
* Load compiler state from a json file.
*/
recordsOutputPath?: string | false;
/**
* Store/Load compiler state from/to a json file. This will result in persistent ids of modules and chunks. An absolute path is expected. `recordsPath` is used for `recordsInputPath` and `recordsOutputPath` if they left undefined.
*/
recordsPath?: string | false;
/**
* Options for the resolver.
*/
resolve?: ResolveOptionsWebpackOptions;
/**
* Options for the resolver when resolving loaders.
*/
resolveLoader?: ResolveOptionsWebpackOptions;
/**
* Options affecting how file system snapshots are created and validated.
*/
snapshot?: SnapshotOptions;
/**
* Stats options object or preset name.
*/
stats?:
| boolean
| "none"
| "summary"
| "errors-only"
| "errors-warnings"
| "minimal"
| "normal"
| "detailed"
| "verbose"
| StatsOptions;
/**
* Environment to build for. An array of environments to build for all of them when possible.
*/
target?: string | false | string[];
/**
* Enter watch mode, which rebuilds on file change.
*/
watch?: boolean;
/**
* Options for the watcher.
*/
watchOptions?: WatchOptions;
}
type ConnectionState =
| boolean
| typeof TRANSITIVE_ONLY
| typeof CIRCULAR_CONNECTION;
declare interface Constructor {
new (...params: any[]): any;
}
declare class ConsumeSharedPlugin {
constructor(options: ConsumeSharedPluginOptions);
/**
* Apply the plugin
*/
apply(compiler: Compiler): void;
}
/**
* Options for consuming shared modules.
*/
declare interface ConsumeSharedPluginOptions {
/**
* Modules that should be consumed from share scope. When provided, property names are used to match requested modules in this compilation.
*/
consumes: Consumes;
/**
* Share scope name used for all consumed modules (defaults to 'default').
*/
shareScope?: string;
}
type Consumes = (string | ConsumesObject)[] | ConsumesObject;
/**
* Advanced configuration for modules that should be consumed from share scope.
*/
declare interface ConsumesConfig {
/**
* Include the fallback module directly instead behind an async request. This allows to use fallback module in initial load too. All possible shared modules need to be eager too.
*/
eager?: boolean;
/**
* Fallback module if no shared module is found in share scope. Defaults to the property name.
*/
import?: string | false;
/**
* Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.
*/
packageName?: string;
/**
* Version requirement from module in share scope.
*/
requiredVersion?: string | false;
/**
* Module is looked up under this key from the share scope.
*/
shareKey?: string;
/**
* Share scope name.
*/
shareScope?: string;
/**
* Allow only a single version of the shared module in share scope (disabled by default).
*/
singleton?: boolean;
/**
* Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).
*/
strictVersion?: boolean;
}
/**
* Modules that should be consumed from share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
*/
exposes: Exposes;
/**
* The filename for this container relative path inside the `output.path` directory.
*/
filename?: string;
/**
* Options for library.
*/
library?: LibraryOptions;
/**
* The name for this container.
*/
name: string;
/**
* The name of the share scope which is shared with the host (defaults to 'default').
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
*/
remotes: Remotes;
/**
* The name of the share scope shared with all remotes (defaults to 'default').
*/
shareScope?: string;
}
declare abstract class ContextElementDependency extends ModuleDependency {
referencedExports: any;
}
declare class ContextExclusionPlugin {
constructor(negativeMatcher: RegExp);
negativeMatcher: RegExp;
/**
* Apply the plugin
*/
apply(compiler: Compiler): void;
}
type ContextMode =
| "sync"
| "eager"
| "weak"
| "async-weak"
| "lazy"
| "lazy-once";
declare abstract class ContextModuleFactory extends ModuleFactory {
* dependencies of the entrypoint that should be evaluated at startup
*/
dependencies: Dependency[];
/**
* dependencies of the entrypoint that should be included but not evaluated
*/
includeDependencies: Dependency[];
/**
* options of the entrypoint
*/
options: EntryOptions;
}
declare abstract class EntryDependency extends ModuleDependency {}
/**
* An object with entry point description.
*/
declare interface EntryDescription {
/**
* The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
chunkLoading?: string | false;
/**
* The entrypoints that the current entrypoint depend on. They must be loaded when this entrypoint is loaded.
*/
dependOn?: string | string[];
/**
* Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.
* The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
*/
runtime?: string;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
wasmLoading?: string | false;
}
/**
* An object with entry point description.
*/
declare interface EntryDescriptionNormalized {
/**
* The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
chunkLoading?: string | false;
/**
* The entrypoints that the current entrypoint depend on. They must be loaded when this entrypoint is loaded.
*/
dependOn?: string[];
/**
* Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.
* Module(s) that are loaded upon startup. The last one is exported.
*/
import?: string[];
/**
* Options for library.
*/
library?: LibraryOptions;
/**
* The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
*/
runtime?: string;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
wasmLoading?: string | false;
}
type EntryItem = string | string[];
type EntryNormalized =
| (() => Promise<EntryStaticNormalized>)
| EntryStaticNormalized;
/**
* Multiple entry bundles are created. The key is the entry name. The value can be a string, an array or an entry description object.
* Enable presets of externals for specific targets.
*/
declare interface ExternalsPresets {
/**
* Treat common electron built-in modules in main and preload context like 'electron', 'ipc' or 'shell' as external and load them via require() when used.
*/
electron?: boolean;
/**
* Treat electron built-in modules in the main context like 'app', 'ipc-main' or 'shell' as external and load them via require() when used.
*/
electronMain?: boolean;
/**
* Treat electron built-in modules in the preload context like 'web-frame', 'ipc-renderer' or 'shell' as external and load them via require() when used.
*/
electronPreload?: boolean;
/**
* Treat electron built-in modules in the renderer context like 'web-frame', 'ipc-renderer' or 'shell' as external and load them via require() when used.
*/
electronRenderer?: boolean;
/**
* Treat node.js built-in modules like fs, path or vm as external and load them via require() when used.
*/
node?: boolean;
/**
* Treat NW.js legacy nw.gui module as external and load it via require() when used.
*/
nwjs?: boolean;
/**
* Treat references to 'http(s)://...' and 'std:...' as external and load them via import when used (Note that this changes execution order as externals are executed before any other code in the chunk).
*/
web?: boolean;
/**
* Treat references to 'http(s)://...' and 'std:...' as external and load them via async import() when used (Note that this external type is an async module, which has various effects on the execution).
*/
webAsync?: boolean;
}
type ExternalsType =
| "var"
| "module"
| "assign"
| "this"
| "window"
| "self"
| "global"
| "commonjs"
| "commonjs2"
| "commonjs-module"
| "amd"
| "amd-require"
| "umd"
| "umd2"
| "jsonp"
| "system"
| "promise"
| "import"
| "script";
declare interface FactorizeModuleOptions {
currentProfile: ModuleProfile;
factory: ModuleFactory;
dependencies: Dependency[];
originModule: null | Module;
context?: string;
}
type FakeHook<T> = T & FakeHookMarker;
declare interface FakeHookMarker {}
declare interface FallbackCacheGroup {
minSize: Record<string, number>;
maxAsyncSize: Record<string, number>;
maxInitialSize: Record<string, number>;
automaticNameDelimiter: string;
}
declare class FetchCompileAsyncWasmPlugin {
constructor();
/**
* Apply the plugin
*/
apply(compiler: Compiler): void;
}
declare class FetchCompileWasmPlugin {
constructor(options?: any);
options: any;
/**
* Apply the plugin
*/
apply(compiler: Compiler): void;
}
/**
* Options object for persistent file-based caching.
*/
declare interface FileCacheOptions {
/**
* Dependencies the build depends on (in multiple categories, default categories: 'defaultWebpack').
* Base directory for the cache (defaults to node_modules/.cache/webpack).
*/
cacheDirectory?: string;
/**
* Locations for the cache (defaults to cacheDirectory / name).
*/
cacheLocation?: string;
/**
* Algorithm used for generation the hash (see node.js crypto package).
*/
hashAlgorithm?: string;
/**
* Time in ms after which idle period the cache storing should happen (only for store: 'pack' or 'idle').
*/
idleTimeout?: number;
/**
* Time in ms after which idle period the initial cache storing should happen (only for store: 'pack' or 'idle').
*/
idleTimeoutForInitialStore?: number;
/**
* List of paths that are managed by a package manager and contain a version or hash in its path so all files are immutable.
*/
immutablePaths?: string[];
/**
* List of paths that are managed by a package manager and can be trusted to not be modified otherwise.
*/
managedPaths?: string[];
/**
* Name for the cache. Different names will lead to different coexisting caches.
*/
name?: string;
/**
* When to store data to the filesystem. (pack: Store data when compiler is idle in a single file).
*/
store?: "pack";
/**
* Filesystem caching.
*/
type: "filesystem";
/**
* Version of the cache data. Different versions won't allow to reuse the cache and override existing content. Update the version when config changed in a way which doesn't allow to reuse cache. This will invalidate the cache.
* Type of library (types included by default are 'var', 'module', 'assign', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
type: string;
/**
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
* The filename of the container as relative path inside the `output.path` directory.
*/
filename?: string;
/**
* Options for library.
*/
library?: LibraryOptions;
/**
* The name of the container.
*/
name?: string;
/**
* The external type of the remote containers.
*/
remoteType?:
| "var"
| "module"
| "assign"
| "this"
| "window"
| "self"
| "global"
| "commonjs"
| "commonjs2"
| "commonjs-module"
| "amd"
| "amd-require"
| "umd"
| "umd2"
| "jsonp"
| "system"
| "promise"
| "import"
| "script";
/**
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
* Check for incompatible wasm types when importing/exporting from/to ESM.
*/
checkWasmTypes?: boolean;
/**
* Define the algorithm to choose chunk ids (named: readable ids for better debugging, deterministic: numeric hash ids for better long term caching, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin).
*/
chunkIds?:
| false
| "natural"
| "named"
| "deterministic"
| "size"
| "total-size";
/**
* Concatenate modules when possible to generate less modules, more efficient code and enable more optimizations by the minimizer.
*/
concatenateModules?: boolean;
/**
* Emit assets even when errors occur. Critical errors are emitted into the generated code and will cause errors at runtime.
*/
emitOnErrors?: boolean;
/**
* Also flag chunks as loaded which contain a subset of the modules.
*/
flagIncludedChunks?: boolean;
/**
* Creates a module-internal dependency graph for top level symbols, exports and imports, to improve unused exports detection.
*/
innerGraph?: boolean;
/**
* Rename exports when possible to generate shorter code (depends on optimization.usedExports and optimization.providedExports, true/"deterministic": generate short deterministic names optimized for caching, "size": generate the shortest possible names).
* Reduce size of WASM by changing imports to shorter strings.
*/
mangleWasmImports?: boolean;
/**
* Merge chunks which contain the same modules.
*/
mergeDuplicateChunks?: boolean;
/**
* Enable minimizing the output. Uses optimization.minimizer.
*/
minimize?: boolean;
/**
* Minimizer(s) to use for minimizing the output.
*/
minimizer?: (
| ((this: Compiler, compiler: Compiler) => void)
| WebpackPluginInstance
| "..."
)[];
/**
* Define the algorithm to choose module ids (natural: numeric ids in order of usage, named: readable ids for better debugging, hashed: (deprecated) short hashes as ids for better long term caching, deterministic: numeric hash ids for better long term caching, size: numeric ids focused on minimal initial download size, false: no algorithm used, as custom one can be provided via plugin).
* Avoid emitting assets when errors occur (deprecated: use 'emitOnErrors' instead).
*/
noEmitOnErrors?: boolean;
/**
* Set process.env.NODE_ENV to a specific value.
*/
nodeEnv?: string | false;
/**
* Generate records with relative paths to be able to move the context folder.
*/
portableRecords?: boolean;
/**
* Figure out which exports are provided by modules to generate more efficient code.
*/
providedExports?: boolean;
/**
* Use real [contenthash] based on final content of the assets.
*/
realContentHash?: boolean;
/**
* Removes modules from chunks when these modules are already included in all parents.
*/
removeAvailableModules?: boolean;
/**
* Remove chunks which are empty.
*/
removeEmptyChunks?: boolean;
/**
* Create an additional chunk which contains only the webpack runtime and chunk hash maps.
*/
runtimeChunk?:
| boolean
| "single"
| "multiple"
| {
/**
* The name or name factory for the runtime chunks.
*/
name?: string | Function;
};
/**
* Skip over modules which contain no side effects when exports are not used (false: disabled, 'flag': only use manually placed side effects flag, true: also analyse source code for side effects).
*/
sideEffects?: boolean | "flag";
/**
* Optimize duplication and caching by splitting chunks by shared modules and cache group.
* Figure out which exports are used by modules to mangle export names, omit unused exports and generate more efficient code (true: analyse used exports for each runtime, "global": analyse exports globally for all runtimes combined).
*/
usedExports?: boolean | "global";
}
/**
* Options object for describing behavior of a cache group selecting modules that should be cached together.
* Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks, default categories: 'default', 'defaultVendors').
*/
cacheGroups?: {
[index: string]:
| string
| false
| Function
| RegExp
| OptimizationSplitChunksCacheGroup;
};
/**
* Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
* The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), but others might be added by plugins).
*/
chunkFormat?: string | false;
/**
* Number of milliseconds before chunk request expires.
*/
chunkLoadTimeout?: number;
/**
* The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
chunkLoading?: string | false;
/**
* The global variable used by webpack for loading of chunks.
*/
chunkLoadingGlobal?: string;
/**
* Check if to be emitted file already exists and have the same content before writing to output filesystem.
*/
compareBeforeEmit?: boolean;
/**
* This option enables cross-origin loading of chunks.
* Module 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.
*/
devtoolNamespace?: string;
/**
* List of chunk loading types enabled for use by entry points.
*/
enabledChunkLoadingTypes?: string[];
/**
* List of library types enabled for use by entry points.
*/
enabledLibraryTypes?: string[];
/**
* List of wasm loading types enabled for use by entry points.
*/
enabledWasmLoadingTypes?: string[];
/**
* The abilities of the environment where the webpack generated code should run.
*/
environment?: Environment;
/**
* Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.
* Specify which export should be exposed as library.
*/
libraryExport?: string | string[];
/**
* Type of library (types included by default are 'var', 'module', 'assign', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
libraryTarget?: string;
/**
* Output javascript files as module source type.
*/
module?: boolean;
/**
* The output directory as **absolute path** (required).
*/
path?: string;
/**
* Include comments with information about the modules.
*/
pathinfo?: boolean | "verbose";
/**
* The `publicPath` specifies the public URL address of the output files when referenced in a browser.
* The filename of the SourceMaps for the JavaScript files. They are inside the `output.path` directory.
*/
sourceMapFilename?: string;
/**
* Prefixes every line of the source in the bundle with this string.
*/
sourcePrefix?: string;
/**
* Handles exceptions in module loading correctly at a performance cost.
*/
strictModuleExceptionHandling?: boolean;
/**
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
*/
umdNamedDefine?: boolean;
/**
* A unique name of the webpack build to avoid multiple webpack runtimes to conflict when using globals.
*/
uniqueName?: string;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
wasmLoading?: string | false;
/**
* The filename of WebAssembly modules as relative path inside the `output.path` directory.
*/
webassemblyModuleFilename?: string;
/**
* The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
workerChunkLoading?: string | false;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
* The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), but others might be added by plugins).
*/
chunkFormat?: string | false;
/**
* Number of milliseconds before chunk request expires.
*/
chunkLoadTimeout?: number;
/**
* The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
chunkLoading?: string | false;
/**
* The global variable used by webpack for loading of chunks.
*/
chunkLoadingGlobal?: string;
/**
* Check if to be emitted file already exists and have the same content before writing to output filesystem.
*/
compareBeforeEmit?: boolean;
/**
* This option enables cross-origin loading of chunks.
* Module 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.
*/
devtoolNamespace?: string;
/**
* List of chunk loading types enabled for use by entry points.
*/
enabledChunkLoadingTypes?: string[];
/**
* List of library types enabled for use by entry points.
*/
enabledLibraryTypes?: string[];
/**
* List of wasm loading types enabled for use by entry points.
*/
enabledWasmLoadingTypes?: string[];
/**
* The abilities of the environment where the webpack generated code should run.
*/
environment?: Environment;
/**
* Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.
* The filename of the SourceMaps for the JavaScript files. They are inside the `output.path` directory.
*/
sourceMapFilename?: string;
/**
* Prefixes every line of the source in the bundle with this string.
*/
sourcePrefix?: string;
/**
* Handles exceptions in module loading correctly at a performance cost.
*/
strictModuleExceptionHandling?: boolean;
/**
* A unique name of the webpack build to avoid multiple webpack runtimes to conflict when using globals.
*/
uniqueName?: string;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
wasmLoading?: string | false;
/**
* The filename of WebAssembly modules as relative path inside the `output.path` directory.
*/
webassemblyModuleFilename?: string;
/**
* The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
workerChunkLoading?: string | false;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
* Modules that should be provided as shared modules to the share scope. When provided, property name is used to match modules, otherwise this is automatically inferred from share key.
*/
provides: Provides;
/**
* Share scope name used for all provided modules (defaults to 'default').
*/
shareScope?: string;
}
type Provides = (string | ProvidesObject)[] | ProvidesObject;
/**
* Advanced configuration for modules that should be provided as shared modules to the share scope.
*/
declare interface ProvidesConfig {
/**
* Include the provided module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.
*/
eager?: boolean;
/**
* Key in the share scope under which the shared modules should be stored.
*/
shareKey?: string;
/**
* Share scope name.
*/
shareScope?: string;
/**
* Version of the provided module. Will replace lower matching versions, but not higher.
*/
version?: string | false;
}
/**
* Modules that should be provided as shared modules to the share scope. Property names are used as share keys.
* Include the context information in the cache identifier when caching.
*/
cacheWithContext?: boolean;
/**
* Condition names for exports field entry point.
*/
conditionNames?: string[];
/**
* Filenames used to find a description file (like a package.json).
*/
descriptionFiles?: string[];
/**
* Enforce the resolver to use one of the extensions from the extensions option (User must specify requests without extension).
*/
enforceExtension?: boolean;
/**
* Field names from the description file (usually package.json) which are used to provide entry points of a package.
*/
exportsFields?: string[];
/**
* Extensions added to the request when trying to find the file.
*/
extensions?: string[];
/**
* Redirect module requests when normal resolving fails.
*/
fallback?:
| {
/**
* New request.
*/
alias: Target;
/**
* Request to be redirected.
*/
name: string;
/**
* Redirect only exact matching request.
*/
onlyModule?: boolean;
}[]
| { [index: string]: Target };
/**
* Filesystem for the resolver.
*/
fileSystem?: InputFileSystem;
/**
* Treats the request specified by the user as fully specified, meaning no extensions are added and the mainFiles in directories are not resolved (This doesn't affect requests from mainFields, aliasFields or aliases).
*/
fullySpecified?: boolean;
/**
* Field names from the description file (usually package.json) which are used to provide internal request of a package (requests starting with # are considered as internal).
*/
importsFields?: string[];
/**
* Field names from the description file (package.json) which are used to find the default entry point.
*/
mainFields?: EntryItem[];
/**
* Filenames used to find the default entry point if there is no description file or main field.
*/
mainFiles?: string[];
/**
* Folder names or directory paths where to find modules.
*/
modules?: string[];
/**
* Plugins for the resolver.
*/
plugins?: ("..." | ResolvePluginInstance)[];
/**
* Prefer to resolve module requests as relative request and fallback to resolving as module.
*/
preferRelative?: boolean;
/**
* Custom resolver.
*/
resolver?: Resolver;
/**
* A list of resolve restrictions. Resolve results must fulfill all of these restrictions to resolve successfully. Other resolve paths are taken when restrictions are not met.
*/
restrictions?: (string | RegExp)[];
/**
* A list of directories in which requests that are server-relative URLs (starting with '/') are resolved. On non-windows system these requests are tried to resolve as absolute path first.
*/
roots?: string[];
/**
* Enable resolving symlinks to the original location.
*/
symlinks?: boolean;
/**
* Enable caching of successfully resolved requests (cache entries are not revalidated).
*/
unsafeCache?: boolean | { [index: string]: any };
/**
* Use synchronous filesystem calls for the resolver.
* Include the context information in the cache identifier when caching.
*/
cacheWithContext?: boolean;
/**
* Condition names for exports field entry point.
*/
conditionNames?: string[];
/**
* Filenames used to find a description file (like a package.json).
*/
descriptionFiles?: string[];
/**
* Enforce the resolver to use one of the extensions from the extensions option (User must specify requests without extension).
*/
enforceExtension?: boolean;
/**
* Field names from the description file (usually package.json) which are used to provide entry points of a package.
*/
exportsFields?: string[];
/**
* Extensions added to the request when trying to find the file.
*/
extensions?: string[];
/**
* Redirect module requests when normal resolving fails.
*/
fallback?:
| {
/**
* New request.
*/
alias: Target;
/**
* Request to be redirected.
*/
name: string;
/**
* Redirect only exact matching request.
*/
onlyModule?: boolean;
}[]
| { [index: string]: Target };
/**
* Filesystem for the resolver.
*/
fileSystem?: InputFileSystem;
/**
* Treats the request specified by the user as fully specified, meaning no extensions are added and the mainFiles in directories are not resolved (This doesn't affect requests from mainFields, aliasFields or aliases).
*/
fullySpecified?: boolean;
/**
* Field names from the description file (usually package.json) which are used to provide internal request of a package (requests starting with # are considered as internal).
*/
importsFields?: string[];
/**
* Field names from the description file (package.json) which are used to find the default entry point.
*/
mainFields?: EntryItem[];
/**
* Filenames used to find the default entry point if there is no description file or main field.
*/
mainFiles?: string[];
/**
* Folder names or directory paths where to find modules.
*/
modules?: string[];
/**
* Plugins for the resolver.
*/
plugins?: ("..." | ResolvePluginInstance)[];
/**
* Prefer to resolve module requests as relative request and fallback to resolving as module.
*/
preferRelative?: boolean;
/**
* Custom resolver.
*/
resolver?: Resolver;
/**
* A list of resolve restrictions. Resolve results must fulfill all of these restrictions to resolve successfully. Other resolve paths are taken when restrictions are not met.
*/
restrictions?: (string | RegExp)[];
/**
* A list of directories in which requests that are server-relative URLs (starting with '/') are resolved. On non-windows system these requests are tried to resolve as absolute path first.
*/
roots?: string[];
/**
* Enable resolving symlinks to the original location.
*/
symlinks?: boolean;
/**
* Enable caching of successfully resolved requests (cache entries are not revalidated).
*/
unsafeCache?: boolean | { [index: string]: any };
/**
* Use synchronous filesystem calls for the resolver.
*/
useSyncFileSystemCalls?: boolean;
dependencyType?: string;
resolveToContext?: boolean;
}
/**
* Plugin instance.
*/
declare interface ResolvePluginInstance {
[index: string]: any;
/**
* The run point of the plugin, required method.
*/
apply: (resolver?: any) => void;
}
type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;
* Share scope name used for all shared modules (defaults to 'default').
*/
shareScope?: string;
/**
* Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.
*/
shared: Shared;
}
type Shared = (string | SharedObject)[] | SharedObject;
/**
* Advanced configuration for modules that should be shared in the share scope.
*/
declare interface SharedConfig {
/**
* Include the provided and fallback module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.
*/
eager?: boolean;
/**
* Provided module that should be provided to share scope. Also acts as fallback module if no shared module is found in share scope or version isn't valid. Defaults to the property name.
*/
import?: string | false;
/**
* Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.
*/
packageName?: string;
/**
* Version requirement from module in share scope.
*/
requiredVersion?: string | false;
/**
* Module is looked up under this key from the share scope.
*/
shareKey?: string;
/**
* Share scope name.
*/
shareScope?: string;
/**
* Allow only a single version of the shared module in share scope (disabled by default).
*/
singleton?: boolean;
/**
* Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).
*/
strictVersion?: boolean;
/**
* Version of the provided module. Will replace lower matching versions, but not higher.
*/
version?: string | false;
}
/**
* Modules that should be shared in the share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.
* Appends the given value to the original asset. Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. false disables the appending.
*/
append?: null | string | false;
/**
* Indicates whether column mappings should be used (defaults to true).
*/
columns?: boolean;
/**
* Exclude modules that match the given value from source map generation.
*/
exclude?: string | RegExp | (string | RegExp)[];
/**
* Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap used only if 'moduleFilenameTemplate' would result in a conflict.
declare class WebpackOptionsApply extends OptionsApply {
constructor();
}
declare class WebpackOptionsDefaulter {
constructor();
process(options?: any): any;
}
/**
* Normalized webpack options object.
*/
declare interface WebpackOptionsNormalized {
/**
* Set the value of `require.amd` and `define.amd`. Or disable AMD support.
*/
amd?: false | { [index: string]: any };
/**
* Report the first error as a hard error instead of tolerating it.
*/
bail?: boolean;
/**
* Cache generated modules and chunks to improve performance for multiple incremental builds.
*/
cache: CacheOptionsNormalized;
/**
* The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
*/
context?: string;
/**
* References to other configurations to depend on.
*/
dependencies?: string[];
/**
* Options for the webpack-dev-server.
*/
devServer?: DevServer;
/**
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
*/
devtool?: string | false;
/**
* The entry point(s) of the compilation.
*/
entry: EntryNormalized;
/**
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
*/
experiments: Experiments;
/**
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
*/
externals: Externals;
/**
* Enable presets of externals for specific targets.
*/
externalsPresets: ExternalsPresets;
/**
* Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).
*/
externalsType?:
| "var"
| "module"
| "assign"
| "this"
| "window"
| "self"
| "global"
| "commonjs"
| "commonjs2"
| "commonjs-module"
| "amd"
| "amd-require"
| "umd"
| "umd2"
| "jsonp"
| "system"
| "promise"
| "import"
| "script";
/**
* Ignore specific warnings.
*/
ignoreWarnings?: ((
warning: WebpackError,
compilation: Compilation
) => boolean)[];
/**
* Options for infrastructure level logging.
*/
infrastructureLogging: InfrastructureLogging;
/**
* Custom values available in the loader context.
*/
loader?: Loader;
/**
* Enable production optimizations or development hints.
*/
mode?: "development" | "production" | "none";
/**
* Options affecting the normal modules (`NormalModuleFactory`).
*/
module: ModuleOptions;
/**
* Name of the configuration. Used when loading multiple configurations.
*/
name?: string;
/**
* Include polyfills or mocks for various node stuff.
*/
node: NodeWebpackOptions;
/**
* Enables/Disables integrated optimizations.
*/
optimization: Optimization;
/**
* Normalized options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.
*/
output: OutputNormalized;
/**
* The number of parallel processed modules in the compilation.
*/
parallelism?: number;
/**
* Configuration for web performance recommendations.
*/
performance?: false | PerformanceOptions;
/**
* Add additional plugins to the compiler.
*/
plugins: (
| ((this: Compiler, compiler: Compiler) => void)
| WebpackPluginInstance
)[];
/**
* Capture timing information for each module.
*/
profile?: boolean;
/**
* Store compiler state to a json file.
*/
recordsInputPath?: string | false;
/**
* Load compiler state from a json file.
*/
recordsOutputPath?: string | false;
/**
* Options for the resolver.
*/
resolve: ResolveOptionsWebpackOptions;
/**
* Options for the resolver when resolving loaders.
*/
resolveLoader: ResolveOptionsWebpackOptions;
/**
* Options affecting how file system snapshots are created and validated.
*/
snapshot: SnapshotOptions;
/**
* Stats options object or preset name.
*/
stats: StatsValue;
/**
* Environment to build for. An array of environments to build for all of them when possible.
*/
target?: string | false | string[];
/**
* Enter watch mode, which rebuilds on file change.
*/
watch?: boolean;
/**
* Options for the watcher.
*/
watchOptions: WatchOptions;
}
/**
* Plugin instance.
*/
declare interface WebpackPluginInstance {
[index: string]: any;
/**
* The run point of the plugin, required method.
*/
apply: (compiler: Compiler) => void;
}
declare interface WithId {
id: string | number;
}
declare interface WithOptions {
/**
* create a resolver with additional/different options