On this page

class ContextElementDependency extends ModuleDependency
Source Code: lib/dependencies/ContextElementDependency.js#L22
new ContextElementDependency(request, sourceOrder?): ContextElementDependency
Source Code: lib/dependencies/ModuleDependency.js#L24
Attributes
request:string
sourceOrder:number

Creates an instance of ModuleDependency.

Source Code: lib/dependencies/ContextElementDependency.js#L58
Type:Record<string, string>
Source Code: lib/Dependency.js#L172

Returns location.

Type:any
Source Code: lib/Dependency.js#L135
Type:boolean
Source Code: lib/dependencies/ModuleDependency.js#L33
Type:[number, number]
Source Code: lib/dependencies/ContextElementDependency.js#L54
Type:string[][] | null
Source Code: lib/dependencies/ModuleDependency.js#L27
Type:string
Source Code: lib/dependencies/ModuleDependency.js#L31
Type:number
Source Code: lib/dependencies/ModuleDependency.js#L29
Type:string
Source Code: lib/dependencies/ModuleDependency.js#L37
Type:boolean
Type:string[][]
Type:string[][]
Type:"*"
Type:"id"
Type:"local"
Type:"@"
Type:string[][]
Type:typeof DependencyTemplate
Type:symbol
Source Code: lib/Dependency.js#L164
Type:string

Returns a dependency category, typical categories are "commonjs", "amd", "esm".

Type:any
Source Code: lib/Dependency.js#L156
Type:string

Returns a display name for the type of dependency.

contextElementDependency.canConcatenate(): boolean
Source Code: lib/Dependency.js#L429
Returns:boolean

Returns true if this dependency can be concatenated

contextElementDependency.couldAffectReferencingModule(): boolean | symbol
Source Code: lib/Dependency.js#L290
Returns:boolean | symbol

Could affect referencing module.

contextElementDependency.createIgnoredModule(context): Module
Source Code: lib/Dependency.js#L421
Attributes
context:string
Returns:Module

Creates an ignored module.

contextElementDependency.deserialize(__namedParameters): void
Source Code: lib/Dependency.js#L451
Attributes

Restores this instance from the provided deserializer context.

contextElementDependency.getCondition(moduleGraph): false | ((moduleGraphConnection: ModuleGraphConnection, runtime: RuntimeSpec) => ConnectionState) | null
Source Code: lib/Dependency.js#L360
Attributes
moduleGraph:ModuleGraph
Returns:false | ((moduleGraphConnection: ModuleGraphConnection, runtime: RuntimeSpec) => ConnectionState) | null

Returns function to determine if the connection is active.

contextElementDependency.getContext(): string | undefined
Source Code: lib/Dependency.js#L274
Returns:string | undefined

Returns a request context.

contextElementDependency.getErrors(moduleGraph): WebpackError[] | null | undefined
Source Code: lib/Dependency.js#L387
Attributes
moduleGraph:ModuleGraph

Returns errors.

contextElementDependency.getExports(moduleGraph): ExportsSpec | undefined
Source Code: lib/Dependency.js#L369
Attributes
moduleGraph:ModuleGraph

Returns the exported names

contextElementDependency.getForwardId(): string | true | null
Source Code: lib/Dependency.js#L298
Returns:string | true | null

Returns the export name this dependency requests from its target module (lazy barrel optimization).

contextElementDependency.getLazyName(): string | null
Source Code: lib/Dependency.js#L315
Returns:string | null

Returns the export name for a LAZY_UNTIL_LOCAL/LAZY_UNTIL_ID classification (lazy barrel optimization).

contextElementDependency.getLazyUntil(): "local" | "id" | "*" | "@" | null
Source Code: lib/Dependency.js#L307
Returns:"local" | "id" | "*" | "@" | null

Returns how this dependency may be deferred when its parent module is side-effect-free (lazy barrel optimization).

contextElementDependency.getModuleEvaluationSideEffectsState(moduleGraph): ConnectionState
Source Code: lib/Dependency.js#L412
Attributes
moduleGraph:ModuleGraph

Gets module evaluation side effects state.

contextElementDependency.getNumberOfIdOccurrences(): number
Source Code: lib/Dependency.js#L403
Returns:number

implement this method to allow the occurrence order plugin to count correctly

contextElementDependency.getReference(moduleGraph): never
Source Code: lib/Dependency.js#L339
Stability: 0Deprecated
Attributes
moduleGraph:ModuleGraph
Returns:never

Returns the referenced module and export

contextElementDependency.getReferencedExports(moduleGraph, runtime): (string[] | ReferencedExport)[]
Source Code: lib/Dependency.js#L351
Attributes
moduleGraph:ModuleGraph
runtime:RuntimeSpec
Returns:(string[] | ReferencedExport)[]

Returns list of exports referenced by this dependency

contextElementDependency.getResourceIdentifier(): string | null
Source Code: lib/Dependency.js#L282
Returns:string | null

Returns an identifier to merge equal requests.

contextElementDependency.getWarnings(moduleGraph): WebpackError[] | null | undefined
Source Code: lib/Dependency.js#L378
Attributes
moduleGraph:ModuleGraph

Returns warnings.

contextElementDependency.isLazy(): boolean
Source Code: lib/Dependency.js#L323
Returns:boolean

Whether the lazy barrel currently defers creating this dependency's target module (lazy barrel optimization).

contextElementDependency.serialize(__namedParameters): void
Source Code: lib/Dependency.js#L437
Attributes

Serializes this instance into the provided serializer context.

contextElementDependency.setLazy(value): void
Source Code: lib/Dependency.js#L331
Attributes
value:boolean

Sets whether the lazy barrel defers creating this dependency's target module (lazy barrel optimization).

contextElementDependency.setLoc(startLine, startColumn, endLine, endColumn): void
Source Code: lib/Dependency.js#L224
Attributes
startLine:number
startColumn:number
endLine:number
endColumn:number

Updates loc using the provided start line.

contextElementDependency.setLocWithIndex(loc, index): void
Source Code: lib/Dependency.js#L242
Attributes

Updates loc from a source location plus an explicit index, without materializing the loc object (keeps get loc lazy). Replaces the dep.loc = Object.create(loc); dep.loc.index = i pattern, which both allocated a copy and stored the index outside the serialized fields.

contextElementDependency.updateHash(hash, context): void
Source Code: lib/Dependency.js#L397
Attributes

Updates the hash with the data contributed by this instance.

ContextElementDependency.canConcatenate(dependency): boolean
Attributes
dependency:Dependency
Returns:boolean

Returns true if the dependency can be concatenated (scope hoisting).

ContextElementDependency.compareLocations(a, b): -1 | 0 | 1
Attributes
Returns:-1 | 0 | 1

Compares two dependencies by source location for sorting a module's dependencies, without materializing the loc objects (get loc caches its result, so comparing through it would retain a location object on every sorted dependency). These dependencies always carry a real source position, so only start (line, column) and the within-statement index are compared; a dependency without an index sorts after one that has an index at the same position.

ContextElementDependency.isLowPriorityDependency(dependency): boolean
Attributes
dependency:Dependency
Returns:boolean

Returns true if the dependency is a low priority dependency.