On this page

Attributes
Attributes
new RuntimeModule(name, stage?): RuntimeModule
Attributes
a readable name
stage:<number>
an optional stage
Attributes
buildInfo:
{BuildInfo}
buildMeta:
{BuildMeta}
chunk:<Chunk>
chunkGraph:<ChunkGraph>
chunksIterable:
{Iterable }
codeGenerationDependencies:<Dependency[]>
compilation:<Compilation>
context:<string> | <null>
debugId:<number>
dependencies:<Dependency[]>
dependentHash:<boolean>
errors:<any>
exportsArgument:<string>
factoryMeta:
{FactoryMeta}
fullHash:<boolean>
hasEqualsChunks:<any>
index2:<number> | <null>
issuer:<Module> | <null>
isUsed:<any>
moduleArgument:<string>
needId:<boolean>
optimizationBailout:<string> | <object[]>
optional:<boolean>
parent:
{DependenciesBlock}
presentationalDependencies:<Dependency[]>
profile:
{ModuleProfile}
renderedHash:<string>
resolveOptions:<ResolveOptions>
stage:<number>
used:<any>
usedExports:
{boolean|SortableSet |null}
useSimpleSourceMap:<boolean>
useSourceMap:<boolean>
warnings:<any>
STAGE_ATTACH:<number>
Runtime modules which attach to handlers of other runtime modules
STAGE_BASIC:<number>
Runtime modules with simple dependencies on other runtime modules
STAGE_NORMAL:<number>
Runtime modules without any dependencies to other runtime modules
STAGE_TRIGGER:<number>
Runtime modules which trigger actions on bootstrap
addBlock(block): void
Attributes
Returns:
{void}

Adds a DependencyBlock to DependencyBlock relationship. This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting)


addCacheDependencies(fileDependencies, contextDependencies, missingDependencies, buildDependencies): void
  • fileDependencies {LazySet} set where file dependencies are added to
  • contextDependencies {LazySet} set where context dependencies are added to
  • missingDependencies {LazySet} set where missing dependencies are added to
  • buildDependencies {LazySet} set where build dependencies are added to
  • Returns: {void}

addChunk(chunk): boolean
Attributes
chunk:<Chunk>
the chunk
Returns:<boolean>
true, when the module was added

addCodeGenerationDependency(codeGenerationDependency): void
Attributes
codeGenerationDependency:<Dependency>
dependency being tied to module. This is a Dependency where the code generation result of the referenced module is needed during code generation. The Dependency should also be added to normal dependencies via addDependency.
Returns:
{void}

addDependency(dependency): void
Attributes
dependency:<Dependency>
Returns:
{void}

addError(error): void
Attributes
the error
Returns:
{void}

addPresentationalDependency(presentationalDependency): void
Attributes
presentationalDependency:<Dependency>
dependency being tied to module. This is a Dependency without edge in the module graph. It's only for presentation.
Returns:
{void}

addWarning(warning): void
Attributes
the warning
Returns:
{void}

attach(compilation, chunk, chunkGraph?): void
Attributes
compilation:<Compilation>
the compilation
chunk:<Chunk>
the chunk
chunkGraph:<ChunkGraph>
the chunk graph
Returns:
{void}

build(options, compilation, resolver, fs, callback): void
  • options {WebpackOptionsNormalizedWithDefaults} webpack options
  • compilation <Compilation> the compilation
  • resolver {ResolverWithOptions} the resolver
  • fs <InputFileSystem> the file system
  • callback <object> callback function
  • Returns: {void}

chunkCondition(chunk, compilation): boolean
Attributes
chunk:<Chunk>
the chunk which condition should be checked
compilation:<Compilation>
the compilation
Returns:<boolean>
true if the module can be placed in the chunk

cleanupForCache(): void
Returns:
{void}

Assuming this module is in the cache. Remove internal references to allow freeing some memory.


clearDependenciesAndBlocks(): void
Returns:
{void}

Removes all dependencies and blocks


clearWarningsAndErrors(): void
Returns:
{void}

removes all warnings and errors


codeGeneration(context): void
  • context {CodeGenerationContext} context for code generation
  • Returns: {CodeGenerationResult} result

deserialize(__namedParameters): void
Attributes
__namedParameters:<ObjectDeserializerContext>
context
Returns:
{void}

generate(): string | null
Returns:<string> | <null>
runtime code

getChunks(): Chunk[]
Returns:<Chunk[]>

getConcatenationBailoutReason(context): void
  • context {ConcatenationBailoutReasonContext} context
  • Returns: <string> | <undefined> reason why this module can't be concatenated, undefined when it can be concatenated

getErrors(): Iterable<WebpackError, any, any> | undefined
Returns:
{Iterable<WebpackError, any, any>|undefined} list of errors if any

getExportsType(moduleGraph, strict?): ExportsType
Attributes
moduleGraph:<ModuleGraph>
the module graph
strict:<boolean>
the importing module is strict
Returns:
{ExportsType} export type "namespace": Exports is already a namespace object. namespace = exports. "dynamic": Check at runtime if __esModule is set. When set: namespace = { ...exports, default: exports }. When not set: namespace = { default: exports }. "default-only": Provide a namespace object with only default export. namespace = { default: exports } "default-with-named": Provide a namespace object with named and default export. namespace = { ...exports, default: exports }

getGeneratedCode(): string | null
Returns:<string> | <null>
runtime code

getNumberOfChunks(): number
Returns:<number>

getNumberOfErrors(): number
Returns:<number>
number of errors

getNumberOfWarnings(): number
Returns:<number>
number of warnings

getRootBlock(): DependenciesBlock
Returns:
{DependenciesBlock}

getSideEffectsConnectionState(moduleGraph): ConnectionState
Attributes
moduleGraph:<ModuleGraph>
the module graph
Returns:
{ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only

getSourceBasicTypes(): ReadonlySet<string>
Returns:
{ReadonlySet } types available (do not mutate)

Basic source types are high-level categories like javascript, css, webassembly, etc. We only have built-in knowledge about the javascript basic type here; other basic types may be added or changed over time by generators and do not need to be handled or detected here.

Some modules, e.g. RemoteModule, may return non-basic source types like "remote" and "share-init" from getSourceTypes(), but their generated output is still JavaScript, i.e. their basic type is JS.


getSourceTypes(): ReadonlySet<string>
Returns:
{ReadonlySet } types available (do not mutate)

getUnsafeCacheData(): UnsafeCacheData
Returns:
{UnsafeCacheData}

Module should be unsafe cached. Get data that's needed for that. This data will be passed to restoreFromUnsafeCache later.


getWarnings(): Iterable<WebpackError, any, any> | undefined
Returns:
{Iterable<WebpackError, any, any>|undefined} list of warnings if any

hasChunkCondition(): boolean
Returns:<boolean>

hasReasonForChunk(chunk, moduleGraph, chunkGraph): boolean
Attributes
chunk:<Chunk>
a chunk
moduleGraph:<ModuleGraph>
the module graph
chunkGraph:<ChunkGraph>
the chunk graph
Returns:<boolean>
true, if the module has any reason why "chunk" should be included

hasReasons(moduleGraph, runtime): boolean
Attributes
moduleGraph:<ModuleGraph>
the module graph
runtime:
{RuntimeSpec} the runtime
Returns:<boolean>
true if at least one other module depends on this module

identifier(): string
Returns:<string>
a unique identifier of the module

invalidateBuild(): void
Returns:
{void}

isAccessibleInChunk(chunkGraph, chunk, ignoreChunk?): boolean
Attributes
chunkGraph:<ChunkGraph>
the chunk graph
chunk:<Chunk>
a chunk
ignoreChunk:<Chunk>
chunk to be ignored
Returns:<boolean>
true, if the module is accessible from "chunk" when ignoring "ignoreChunk"

isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk?): boolean
Attributes
chunkGraph:<ChunkGraph>
the chunk graph
chunkGroup:<ChunkGroup>
a chunk group
ignoreChunk:<Chunk>
chunk to be ignored
Returns:<boolean>
true, if the module is accessible from "chunkGroup" when ignoring "ignoreChunk"

isEntryModule(): boolean
Returns:<boolean>

isInChunk(chunk): boolean
Attributes
chunk:<Chunk>
the chunk
Returns:<boolean>
true, when the module is in the chunk

isOptional(moduleGraph): boolean
Attributes
moduleGraph:<ModuleGraph>
the module graph
Returns:<boolean>
true, if the module is optional

isProvided(exportName): boolean | null
Attributes
exportName:<string>
a name of an export
Returns:<boolean> | <null>
true, if the export is provided why the module. null, if it's unknown. false, if it's not provided.

libIdent(options): void
  • options {LibIdentOptions} options
  • Returns: <string> | <null> an identifier for library inclusion

nameForCondition(): string | null
Returns:<string> | <null>
absolute path which should be used for condition matching (usually the resource path)

needBuild(context, callback): void
  • context {NeedBuildContext} context info
  • callback <object> callback function, returns true, if the module needs a rebuild
  • Returns: {void}

needRebuild(fileTimestamps, contextTimestamps): void
Stability: 0Deprecated
  • fileTimestamps {Map<string, number|null>}
  • contextTimestamps {Map<string, number|null>}
  • Returns: <boolean>

Use needBuild instead


originalSource(): Source | null
Returns:<Source> | <null>
the original source for the module before webpack transformation

readableIdentifier(requestShortener): void
  • requestShortener {RequestShortener} the request shortener
  • Returns: <string> a user readable identifier of the module

removeChunk(chunk): void
Attributes
chunk:<Chunk>
the chunk
Returns:
{void}

removeDependency(dependency): void
Attributes
dependency:<Dependency>
Returns:
{void}

serialize(__namedParameters): void
Attributes
__namedParameters:<ObjectSerializerContext>
context
Returns:
{void}

shouldIsolate(): boolean
Returns:<boolean>
true, if the runtime module should get it's own scope

size(type?): number
Attributes
the source type for which the size should be estimated
Returns:<number>
the estimated size of the module (must be non-zero)

source(dependencyTemplates, runtimeTemplate, type?): void
Stability: 0Deprecated
  • dependencyTemplates {DependencyTemplates}
  • runtimeTemplate {RuntimeTemplate}
  • type <string>
  • Returns: <Source>

Use codeGeneration() instead


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

Assuming this module is in the cache. Update the (cached) module with the fresh module from the factory. Usually updates internal references and properties.


updateHash(hash, context): void
  • hash {Hash} the hash used to track dependencies
  • context {UpdateHashContextDependency} context
  • Returns: {void}

Attributes
module:<Module>
Returns:
{ReadonlySet } types available (do not mutate)

Basic source types are high-level categories like javascript, css, webassembly, etc. We only have built-in knowledge about the javascript basic type here; other basic types may be added or changed over time by generators and do not need to be handled or detected here.

Some modules, e.g. RemoteModule, may return non-basic source types like "remote" and "share-init" from getSourceTypes(), but their generated output is still JavaScript, i.e. their basic type is JS.