On this page

new Compilation(compiler, params): Compilation
Attributes
compiler:<Compiler>
params:
{CompilationParams}

Creates an instance of Compilation.

Attributes
additionalChunkAssets:<string[]>
addModuleQueue:
{AsyncQueue<Module, string, Module>}
assets:
{CompilationAssets}
assetsInfo:
{Map<string, AssetInfo>}
asyncEntrypoints:<Entrypoint[]>
buildDependencies:
{LazySet }
buildQueue:
{AsyncQueue<Module, Module, Module>}
buildTimeExecutedModules:
{WeakSet }
builtModules:
{WeakSet }
childrenCounters:
{Record<string, number>}
chunkGraph:<ChunkGraph>
chunkGroups:<ChunkGroup[]>
chunks:
{Set }
chunkTemplate:
{ChunkTemplate}
codeGeneratedModules:
{WeakSet }
codeGenerationResults:<CodeGenerationResults>
comparedForEmitAssets:
{Set }
compilationDependencies:<object>
compiler:<Compiler>
compilerPath:<string>
contextDependencies:
{LazySet }
creatingModuleDuringBuild:
{WeakMap<Module, Set >} Modules in value are building during the build of Module in key. Means value blocking key from finishing. Needed to detect build cycles.
dependencyFactories:
{Map<DependencyConstructor, ModuleFactory>}
dependencyTemplates:
{DependencyTemplates}
emittedAssets:
{Set }
endTime:<number>
entries:
{Map<string, EntryData>}
entrypoints:
{Map<string, Entrypoint>}
errors:<Error[]>
factorizeQueue:
{AsyncQueue<FactorizeModuleOptions, string, Module|ModuleFactoryResult>}
fileDependencies:
{LazySet }
fileSystemInfo:
{FileSystemInfo}
fullHash:<string>
globalEntry:
{EntryData}
hooks:
{Readonly }
inputFileSystem:<InputFileSystem>
logger:
{WebpackLogger}
logging:
{Map<string, LogEntry[]>}
mainTemplate:
{MainTemplate}
missingDependencies:
{LazySet }
moduleGraph:<ModuleGraph>
moduleMemCaches:
{Map<Module, WeakTupleMap<any[], any>>}
moduleMemCaches2:
{Map<Module, WeakTupleMap<any[], any>>}
modules:
{Set }
moduleTemplates:
{ModuleTemplates}
namedChunkGroups:
{Map<string, ChunkGroup>}
namedChunks:
{Map<string, Chunk>}
needAdditionalPass:<boolean>
options:
{WebpackOptionsNormalizedWithDefaults}
outputOptions:
{OutputNormalizedWithDefaults}
params:
{CompilationParams}
processDependenciesQueue:
{AsyncQueue<Module, Module, Module>}
profile:<boolean>
rebuildQueue:
{AsyncQueue<Module, Module, Module>}
records:<null>
requestShortener:
{RequestShortener}
resolverFactory:
{ResolverFactory}
runtimeTemplate:
{RuntimeTemplate}
startTime:<number>
usedChunkIds:
{Set |null}
usedModuleIds:
{Set |null}
valueCacheVersions:
{Map<string, ValueCacheVersion>}
warnings:<Error[]>
PROCESS_ASSETS_STAGE_ADDITIONAL:<number>
Add additional assets to the compilation.
PROCESS_ASSETS_STAGE_ADDITIONS:<number>
Add additional sections to existing assets, like a banner or initialization code.
PROCESS_ASSETS_STAGE_ANALYSE:<number>
Analyse existing assets.
PROCESS_ASSETS_STAGE_DERIVED:<number>
Derive new assets from existing assets. Existing assets should not be treated as complete.
PROCESS_ASSETS_STAGE_DEV_TOOLING:<number>
Add development tooling to assets, e. g. by extracting a SourceMap.
PROCESS_ASSETS_STAGE_OPTIMIZE:<number>
Optimize existing assets in a general way.
PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY:<number>
Optimize the compatibility of existing assets, e. g. add polyfills or vendor-prefixes.
PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT:<number>
Optimize the count of existing assets, e. g. by merging them. Only assets of the same type should be merged. For assets of different types see PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE.
PROCESS_ASSETS_STAGE_OPTIMIZE_HASH:<number>
Optimize the hashes of the assets, e. g. by generating real hashes of the asset content.
PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE:<number>
Optimize the count of existing assets, e. g. by inlining assets of into other assets. Only assets of different types should be inlined. For assets of the same type see PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT.
PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE:<number>
Optimize the size of existing assets, e. g. by minimizing or omitting whitespace.
PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER:<number>
Optimize the transfer of existing assets, e. g. by preparing a compressed (gzip) file as separate asset.
PROCESS_ASSETS_STAGE_PRE_PROCESS:<number>
Basic preprocessing of assets.
PROCESS_ASSETS_STAGE_REPORT:<number>
Creating assets for reporting purposes.
PROCESS_ASSETS_STAGE_SUMMARIZE:<number>
Summarize the list of existing assets e. g. creating an assets manifest of Service Workers.
addAsyncEntrypoint(options, module, loc, request): Entrypoint
Attributes
module:<Module>
loc:
{DependencyLocation}
request:<string>
Returns:<Entrypoint>

Adds the provided async entrypoint to this chunk group.


addChunk(name?): Chunk
Attributes
Returns:<Chunk>

This method first looks to see if a name is provided for a new chunk, and first looks to see if any named chunks already exist and reuse that chunk instead.


addChunkInGroup(groupOptions, module?, loc?, request?): ChunkGroup
Attributes
groupOptions:<string>
module:<Module>
loc:
{SyntheticDependencyLocation|RealDependencyLocation}
request:<string>
Returns:<ChunkGroup>

If module is passed, loc and request must also be passed.


addEntry(context, entry, optionsOrName, callback): void
Attributes
context:<string>
optionsOrName:<string> | <EntryOptions>
callback:<object>
Returns:
{void}

Adds the provided string to the compilation.


addInclude(context, dependency, options, callback): void
Attributes
context:<string>
dependency:<Dependency>
callback:<object>
Returns:
{void}

Adds the provided string to the compilation.


addModule(module, callback): void
Attributes
module:<Module>
callback:<object>
Returns:
{void}

Adds the provided module to the compilation.


addModuleChain(context, dependency, callback): void
Attributes
context:<string>
dependency:<Dependency>
callback:<object>
Returns:
{void}

Adds the provided string to the compilation.


addModuleTree(__namedParameters, callback): void
Attributes
__namedParameters:<object>
callback:<object>
Returns:
{void}

Adds the provided object to the compilation.


addRuntimeModule(chunk, module, chunkGraph?): void
Attributes
chunk:<Chunk>
chunkGraph:<ChunkGraph>
Returns:
{void}

Adds runtime module.


assignDepth(module): void
Stability: 0Deprecated
Attributes
module:<Module>
Returns:
{void}

Processes the provided module.


assignDepths(modules): void
  • modules {Module[]|Set}
  • Returns: {void}

Assigns depth values to the provided modules.


assignRuntimeIds(): void
Returns:
{void}

buildModule(module, callback): void
Attributes
module:<Module>
callback:<object>
Returns:
{void}

Schedules a build of the module object


checkConstraints(): void
Returns:
{void}

clearAssets(): void
Returns:
{void}

codeGeneration(callback): void
Attributes
callback:<object>
Returns:
{void}

Generates code and runtime requirements for this module.


createChildCompiler(name, outputOptions?, plugins?): Compiler
Attributes
outputOptions:
{Partial }
Returns:<Compiler>

This function allows you to run another instance of webpack inside of webpack however as a child with different settings and configurations (if desired) applied. It copies all hooks, plugins from parent (or top level compiler) and creates a child Compilation


createChunkAssets(callback): void
Attributes
callback:<object>
Returns:
{void}

Creates a chunk assets.


createHash(): CodeGenerationJob[]
Returns:
{CodeGenerationJob[]}

createModuleAssets(): void
Returns:
{void}

createModuleHashes(): void
Returns:
{void}

createStatsFactory(options): void
  • options {NormalizedStatsOptions}
  • Returns: {StatsFactory}

Creates a stats factory.


createStatsOptions(optionsOrPreset?, context?): NormalizedStatsOptions
Attributes
optionsOrPreset:<string> | <boolean> | <StatsOptions>
context:
{CreateStatsOptionsContext}
Returns:
{NormalizedStatsOptions}

Creates a stats options.


createStatsPrinter(options): void
  • options {NormalizedStatsOptions}
  • Returns: {StatsPrinter}

Creates a stats printer.


deleteAsset(file): void
Attributes
Returns:
{void}

Processes the provided file.


emitAsset(file, source, assetInfo?): void
Attributes
source:<Source>
assetInfo:<AssetInfo>
Returns:
{void}

Processes the provided file.


executeModule(module, options, callback): void
Attributes
module:<Module>
options:
{ExecuteModuleOptions}
callback:<object>
Returns:
{void}

Processes the provided module.


factorizeModule(options, callback): void
Attributes
options:<object>
callback:<object>
Returns:
{void}

Processes the provided module callback.

Attributes
options:<object>
callback:<object>
Returns:
{void}

Processes the provided module factory result callback.


findModule(identifier): Module | undefined
Attributes
identifier:<string>

Attempts to search for a module by its identifier


finish(callback): void
Attributes
callback:<object>
Returns:
{void}

Processes the provided callback.


getAsset(name): Readonly<Asset> | undefined
Attributes
Returns:
{Readonly |undefined}

Returns the asset or undefined when not found.


getAssetPath(filename, data): void
  • filename {string|TemplatePathFn}
  • data {T}
  • Returns: <string>

Returns interpolated path.


getAssetPathWithInfo(filename, data): void
  • filename {string|TemplatePathFn}
  • data {T}
  • Returns: {InterpolatedPathAndAssetInfo}

Gets asset path with info.


getAssets(): Readonly<Asset>[]
Returns:
{Readonly []}

getCache(name): CacheFacade
Attributes
Returns:
{CacheFacade}

Returns the cache facade instance.


getDependencyReferencedExports(dependency, runtime): string[]
Attributes
dependency:<Dependency>
runtime:
{RuntimeSpec}
Returns:<string[]>

Gets dependency referenced exports.


getErrors(): Error[]
Returns:<Error[]>

getLogger(name): WebpackLogger
Attributes
Returns:
{WebpackLogger}

Returns a logger with that name.


getModule(module): Module
Attributes
module:<Module>
Returns:<Module>

Fetches a module from a compilation by its identifier


getPath(filename, data?): void
  • filename {string|TemplatePathFn}
  • data {T}
  • Returns: <string>

Returns interpolated path.


getPathWithInfo(filename, data?): void
  • filename {string|TemplatePathFn}
  • data {T}
  • Returns: {InterpolatedPathAndAssetInfo}

Gets path with info.


getRenderManifest(options): RenderManifestEntry[]
Attributes

Gets render manifest.


getStats(): Stats
Returns:<Stats>

getWarnings(): Error[]
Returns:<Error[]>

handleModuleCreation(__namedParameters, callback): void
  • __namedParameters {HandleModuleCreationOptions}
  • callback <object>
  • Returns: {void}

Handle module creation.


patchChunksAfterReasonRemoval(module, chunk): void
Attributes
module:<Module>
chunk:<Chunk>
Returns:
{void}

Patch chunks after reason removal.


processModuleDependencies(module, callback): void
Attributes
module:<Module>
callback:<object>
Returns:
{void}

Process module dependencies.


processModuleDependenciesNonRecursive(module): void
Attributes
module:<Module>
Returns:
{void}

Process module dependencies non recursive.


processRuntimeRequirements(__namedParameters?): void
Attributes
__namedParameters:<object>
Returns:
{void}

Process runtime requirements.


rebuildModule(module, callback): void
Attributes
module:<Module>
callback:<object>
Returns:
{void}

Processes the provided module.


removeChunkFromDependencies(block, chunk): void
  • block {DependenciesBlock}
  • chunk <Chunk>
  • Returns: {void}

Removes chunk from dependencies.


removeReasonsOfDependencyBlock(module, block): void
Attributes
module:<Module>
block:
{DependenciesBlockLike}
Returns:
{void}

Removes reasons of dependency block.


renameAsset(file, newFile): void
Attributes
newFile:<string>
Returns:
{void}

Processes the provided file.


reportDependencyErrorsAndWarnings(module, blocks): boolean
Attributes
module:<Module>
blocks:
{DependenciesBlock[]}
Returns:<boolean>

Report dependency errors and warnings.


seal(callback): void
Attributes
callback:<object>
Returns:
{void}

Processes the provided callback.


sortItemsWithChunkIds(): void
Returns:
{void}

summarizeDependencies(): void
Returns:
{void}

unseal(): void
Returns:
{void}

updateAsset(file, newSourceOrFunction, assetInfoUpdateOrFunction?): void
Attributes
newSourceOrFunction:<Source> | <object>
assetInfoUpdateOrFunction:<AssetInfo> | <object>
Returns:
{void}

Updates asset using the provided file.