On this page

new Compilation(compiler, params): Compilation
Attributes
compiler:<Compiler>
the compiler which created the compilation
params:
{CompilationParams} the compilation parameters

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
options for the entrypoint
module:<Module>
the module the references the chunk group
loc:
{DependencyLocation} the location from with the chunk group is referenced (inside of module)
request:<string>
the request from which the chunk group is referenced
Returns:<Entrypoint>
the new or existing entrypoint

addChunk(name?): Chunk
Attributes
optional chunk name to be provided
Returns:<Chunk>
create a chunk (invoked during seal event)

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>
options for the chunk group
module:<Module>
the module the references the chunk group
loc:
{SyntheticDependencyLocation|RealDependencyLocation} the location from with the chunk group is referenced (inside of module)
request:<string>
the request from which the chunk group is referenced
Returns:<ChunkGroup>
the new or existing chunk group

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


addEntry(context, entry, optionsOrName, callback): void
Attributes
context:<string>
context path for entry
entry dependency that should be followed
optionsOrName:<string> | <EntryOptions>
options or deprecated name of entry
callback:<object>
callback function
Returns:
{void} returns

addInclude(context, dependency, options, callback): void
Attributes
context:<string>
context path for entry
dependency:<Dependency>
dependency that should be followed
options
callback:<object>
callback function
Returns:
{void} returns

addModule(module, callback): void
Attributes
module:<Module>
module to be added that was created
callback:<object>
returns the module in the compilation, it could be the passed one (if new), or an already existing in the compilation
Returns:
{void}

addModuleChain(context, dependency, callback): void
Attributes
context:<string>
context string path
dependency:<Dependency>
dependency used to create Module chain
callback:<object>
callback for when module chain is complete
Returns:
{void} will throw if dependency instance is not a valid Dependency

addModuleTree(__namedParameters, callback): void
Attributes
__namedParameters:<object>
callback:<object>
callback for when module chain is complete
Returns:
{void} will throw if dependency instance is not a valid Dependency

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

assignDepth(module): void
Attributes
module:<Module>
module to assign depth
Returns:
{void}

assignDepths(modules): void
  • modules {Set} module to assign depth
  • Returns: {void}

assignRuntimeIds(): void
Returns:
{void}

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

Schedules a build of the module object


checkConstraints(): void
Returns:
{void}

clearAssets(): void
Returns:
{void}

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

createChildCompiler(name, outputOptions?, plugins?): Compiler
Attributes
name of the child compiler
outputOptions:
{Partial } // Need to convert config schema to types for this
webpack plugins that will be applied
Returns:<Compiler>
creates a child Compiler instance

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>
signals when the call finishes
Returns:
{void}

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

createModuleAssets(): void
Returns:
{void}

createModuleHashes(): void
Returns:
{void}

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

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

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

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

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

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

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

findModule(identifier): Module | undefined
Attributes
identifier:<string>
identifier (usually path) for module
attempt to search for module and return it, else undefined

Attempts to search for a module by its identifier


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

getAsset(name): Readonly<Asset> | undefined
Attributes
the name of the asset
Returns:
{Readonly |undefined} the asset or undefined when not found

getAssetPath(filename, data): string
Attributes
used to get asset path with hash
context data
Returns:<string>
interpolated path

getAssetPathWithInfo(filename, data): InterpolatedPathAndAssetInfo
Attributes
used to get asset path with hash
context data
Returns:
{InterpolatedPathAndAssetInfo} interpolated path and asset info

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

getCache(name): CacheFacade
Attributes
cache name
Returns:
{CacheFacade} the cache facade instance

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

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

getLogger(name): WebpackLogger
Attributes
name of the logger, or function called once to get the logger name
Returns:
{WebpackLogger} a logger with that name

getModule(module): Module
Attributes
module:<Module>
the module provided
Returns:<Module>
the module requested

Fetches a module from a compilation by its identifier


getPath(filename, data?): string
Attributes
used to get asset path with hash
context data
Returns:<string>
interpolated path

getPathWithInfo(filename, data?): InterpolatedPathAndAssetInfo
Attributes
used to get asset path with hash
context data
Returns:
{InterpolatedPathAndAssetInfo} interpolated path and asset info

getRenderManifest(options): RenderManifestEntry[]
Attributes
options object
manifest entries

getStats(): Stats
Returns:<Stats>

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

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

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

processModuleDependencies(module, callback): void
Attributes
module:<Module>
to be processed for deps
callback:<object>
callback to be triggered
Returns:
{void}

processModuleDependenciesNonRecursive(module): void
Attributes
module:<Module>
to be processed for deps
Returns:
{void}

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

rebuildModule(module, callback): void
Attributes
module:<Module>
module to be rebuilt
callback:<object>
callback when module finishes rebuilding
Returns:
{void}

removeChunkFromDependencies(block, chunk): void
  • block {DependenciesBlock} block tie for Chunk
  • chunk <Chunk> chunk to remove from dep
  • Returns: {void}

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

renameAsset(file, newFile): void
Attributes
file name
newFile:<string>
the new name of file
Returns:
{void}

reportDependencyErrorsAndWarnings(module, blocks): boolean
Attributes
module:<Module>
module to report from
blocks:
{DependenciesBlock[]} blocks to report from
Returns:<boolean>
true, when it has warnings or errors

seal(callback): void
Attributes
callback:<object>
signals when the call finishes
Returns:
{void}

sortItemsWithChunkIds(): void
Returns:
{void}

summarizeDependencies(): void
Returns:
{void}

unseal(): void
Returns:
{void}

updateAsset(file, newSourceOrFunction, assetInfoUpdateOrFunction?): void
Attributes
file name
newSourceOrFunction:<Source> | <object>
new asset source or function converting old to new
assetInfoUpdateOrFunction:<AssetInfo> | <object>
new asset info or function converting old to new
Returns:
{void}