On this page

class webpack.ExternalModule extends Module
new ExternalModule(request, type, userRequest, dependencyMeta?): ExternalModule
Attributes
request
type
userRequest:string
user request

Creates an instance of ExternalModule.

Attributes
buildInfo:BuildInfo
buildMeta:BuildMeta
chunksIterable:Iterable<Chunk>
codeGenerationDependencies:Dependency[]
context:string | null
debugId:number
dependencies:Dependency[]
depth:number | null
Returns the depth. Updates the depth using the provided value.
errors:any
exportsArgument:string
Gets exports argument.
externalType:ExternalsType
factoryMeta:FactoryMeta
hasEqualsChunks:any
hash:string
Returns the hash of the module.
id:string | number | null
Returns the module id assigned by the chunk graph. Updates the module id using the provided value.
index:number | null
Returns the pre-order index. Updates the pre-order index using the provided value.
index2:number | null
Returns the post-order index. Updates the post-order index using the provided value.
issuer:Module | null
Returns the issuer. Updates the issuer using the provided value.
isUsed:any
layer:string | null
moduleArgument:string
Gets module argument.
needId:boolean
optimizationBailout:(string | ((requestShortener: RequestShortener) => string))[]
Gets optimization bailout.
optional:boolean
presentationalDependencies:Dependency[]
renderedHash:string
Returns the rendered hash of the module.
resolveOptions:ResolveOptions
type:string
used:any
usedExports:boolean | SortableSet<string> | null
userRequest:string
useSimpleSourceMap:boolean
useSourceMap:boolean
warnings:any
getExternalModuleNodeCommonjsInitFragment:(runtimeTemplate: RuntimeTemplate) => InitFragment<ChunkRenderContextJavascriptModulesPlugin>
Gets external module node commonjs init fragment.
ModuleExternalInitFragment:typeof ModuleExternalInitFragment
Represents ModuleExternalInitFragment.
addBlock(block): void
Attributes

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
Attributes
fileDependencies:LazySet<string>
contextDependencies:LazySet<string>
missingDependencies:LazySet<string>
buildDependencies:LazySet<string>
Returns:void

Adds the provided file dependencies to the module.


addChunk(chunk): boolean
Stability: 0Deprecated
Attributes
chunk:Chunk
Returns:boolean

Adds the provided chunk to the module.


addCodeGenerationDependency(codeGenerationDependency): void
Attributes
codeGenerationDependency:Dependency
Returns:void

Adds code generation dependency.


addDependency(dependency): void
Attributes
dependency:Dependency
Returns:void

Adds the provided dependency to the dependencies block.


addError(error): void
Attributes
error:Error
Returns:void

Adds the provided error to the module.


addPresentationalDependency(presentationalDependency): void
Attributes
presentationalDependency:Dependency
Returns:void

Adds presentational dependency.


addWarning(warning): void
Attributes
warning:Error
Returns:void

Adds the provided warning to the module.


build(options, compilation, resolver, fs, callback): void
Attributes
compilation:Compilation
the compilation
the resolver
the file system
callback:(err?: WebpackError) => void
callback function
Returns:void

Builds the module using the provided compilation context.


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

Returns 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

Clear dependencies and blocks.


clearWarningsAndErrors(): void
Returns:void

removes all warnings and errors


codeGeneration(context): CodeGenerationResult
Attributes
context for code generation
result

Generates code and runtime requirements for this module.


deserialize(objectDeserializerContext): void
Attributes
objectDeserializerContext:ObjectDeserializerContext
Returns:void

Restores this instance from the provided deserializer context.


getChunks(): Chunk[]
Stability: 0Deprecated
Returns:Chunk[]

getConcatenationBailoutReason(context): string | undefined
Attributes
Returns:string | undefined
reason why this module can't be concatenated, undefined when it can be concatenated

Returns the reason this module cannot be concatenated, when one exists.


getErrors(): Error[] | undefined
Returns:Error[] | undefined

Returns list of errors if any.


getExportsType(moduleGraph, strict?): ExportsType
Attributes
moduleGraph:ModuleGraph
strict:boolean
Returns:ExportsType

Returns export type.


getNumberOfChunks(): number
Stability: 0Deprecated
Returns:number

getNumberOfErrors(): number
Returns:number

Gets number of errors.


getNumberOfWarnings(): number
Returns:number

Gets number of warnings.


getRootBlock(): DependenciesBlock

getSideEffectsConnectionState(moduleGraph): ConnectionState
Attributes
moduleGraph:ModuleGraph

Gets side effects connection state.


getSourceBasicTypes(): ReadonlySet<string>
Returns:ReadonlySet<string>

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<string>
types available (do not mutate)

Returns the source types this module can generate.


getUnsafeCacheData(): UnsafeCacheData

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


getWarnings(): Error[] | undefined
Returns:Error[] | undefined

Returns list of warnings if any.


hasChunkCondition(): boolean
Returns:boolean

hasReasonForChunk(chunk, moduleGraph, chunkGraph): boolean
Attributes
chunk:Chunk
moduleGraph:ModuleGraph
chunkGraph:ChunkGraph
Returns:boolean

Checks whether this module contains the chunk.


hasReasons(moduleGraph, runtime): boolean
Attributes
moduleGraph:ModuleGraph
runtime:RuntimeSpec
Returns:boolean

Checks whether this module contains the module graph.


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

Returns the unique identifier used to reference this module.


invalidateBuild(): void
Returns:void

Invalidates the cached state associated with this value.


isAccessibleInChunk(chunkGraph, chunk, ignoreChunk?): boolean
Attributes
chunkGraph:ChunkGraph
chunk:Chunk
ignoreChunk:Chunk
Returns:boolean

Checks whether this module is accessible in chunk.


isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk?): boolean
Attributes
chunkGraph:ChunkGraph
chunkGroup:ChunkGroup
ignoreChunk:Chunk
Returns:boolean

Checks whether this module is accessible in chunk group.


isEntryModule(): boolean
Stability: 0Deprecated
Returns:boolean

isInChunk(chunk): boolean
Stability: 0Deprecated
Attributes
chunk:Chunk
Returns:boolean

Checks whether this module is in the provided chunk.


isOptional(moduleGraph): boolean
Attributes
moduleGraph:ModuleGraph
Returns:boolean

Checks whether this module is optional.


isProvided(exportName): boolean | null
Stability: 0Deprecated
Attributes
exportName:string
Returns:boolean | null

Checks whether this module provides the specified export.


libIdent(options): string | null
Attributes
options
Returns:string | null
an identifier for library inclusion

Gets the library identifier.


nameForCondition(): string | null
Returns:string | null

Returns the path used when matching this module against rule conditions.


needBuild(context, callback): void
Attributes
context info
callback:(err?: WebpackError | null, needBuild?: boolean) => void
callback function, returns true, if the module needs a rebuild
Returns:void

Checks whether the module needs to be rebuilt for the current build state.


needRebuild(fileTimestamps, contextTimestamps): boolean
Stability: 0Deprecated: Use needBuild instead
Attributes
fileTimestamps:Map<string, number | null>
contextTimestamps:Map<string, number | null>
Returns:boolean

Checks whether it needs rebuild.


originalSource(): Source | null
Returns:Source | null

Gets the original source.


readableIdentifier(requestShortener): string
Attributes
requestShortener:RequestShortener
the request shortener
Returns:string
a user readable identifier of the module

Returns a human-readable identifier for this module.


removeChunk(chunk): void
Stability: 0Deprecated
Attributes
chunk:Chunk
Returns:void

Removes the provided chunk from the module.


removeDependency(dependency): void
Attributes
dependency:Dependency
Returns:void

Removes dependency.


restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory): void
Attributes
unsafeCacheData:UnsafeCacheData
data from getUnsafeCacheData
normalModuleFactory:NormalModuleFactory
the normal module factory handling the unsafe caching
Returns:void

restore unsafe cache data


serialize(objectSerializerContext): void
Attributes
objectSerializerContext:ObjectSerializerContext
Returns:void

Serializes this instance into the provided serializer context.


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

Returns the estimated size for the requested source type.


source(dependencyTemplates, runtimeTemplate, type?): Source
Stability: 0Deprecated: Use codeGeneration() instead
Attributes
dependencyTemplates:DependencyTemplates
runtimeTemplate:RuntimeTemplate
type:string
Returns:Source

Returns generated source.


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
Attributes
hash:Hash
the hash used to track dependencies
Returns:void

Updates the hash with the data contributed by this instance.


Attributes
compilation:Compilation
the compilation
the attached hooks

Returns the attached hooks.


Stability: 0Deprecated: In webpack 6, call getSourceBasicTypes() directly on the module instance instead of using this static method.
Attributes
module:Module
Returns:ReadonlySet<string>

Gets source basic types.

Attributes
sourceType:"asset-url" | "css-url"

Attributes
layer:string
media:string
supports:string

Attributes
chunkCondition:SyncBailHook<[Chunk, Compilation], boolean>