On this page

new Dependency(): Dependency
Returns:Dependency
Attributes
category:string
Returns a dependency category, typical categories are "commonjs", "amd", "esm".
disconnect:any
Returns location.
module:any
optional:boolean
type:string
Returns a display name for the type of dependency.
EXPORTS_OBJECT_REFERENCED:string[][]
EXPORTS_OBJECT_REFERENCED_MANGLEABLE:string[][]
LAZY_UNTIL_FALLBACK:"*"
LAZY_UNTIL_ID:"id"
LAZY_UNTIL_LOCAL:"local"
Lazy barrel classification of a dependency within a side-effect-free module. LAZY_UNTIL_LOCAL : locally provided export name ( getLazyName ), requesting it requires no dependency. LAZY_UNTIL_ID : named re-export ( getLazyName ) deferred until the export name is requested. LAZY_UNTIL_FALLBACK : star re-export, deferred until an unknown name or all names are requested. LAZY_UNTIL_REQUEST : deferred together with other dependencies of the same request.
LAZY_UNTIL_REQUEST:"@"
NO_EXPORTS_REFERENCED:string[][]
TRANSITIVE:symbol
canConcatenate(): boolean
Returns:boolean
true if this dependency supports concatenation

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


couldAffectReferencingModule(): boolean | symbol
Returns:boolean | symbol
true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module

Could affect referencing module.


createIgnoredModule(context): Module
Attributes
context:string
context directory
Returns:Module
ignored module

Creates an ignored module.


deserialize(objectDeserializerContextObjectMiddlewareObject_4): void
Attributes
objectDeserializerContextObjectMiddlewareObject_4:ObjectDeserializerContextObjectMiddlewareObject_4
Returns:void

Restores this instance from the provided deserializer context.


getCondition(moduleGraph): false | ((moduleGraphConnection: ModuleGraphConnection, runtime: RuntimeSpec) => ConnectionState) | null
Attributes
moduleGraph:ModuleGraph
module graph
Returns:false | ((moduleGraphConnection: ModuleGraphConnection, runtime: RuntimeSpec) => ConnectionState) | null
function to determine if the connection is active

Returns function to determine if the connection is active.


getContext(): string | undefined
Returns:string | undefined
a request context

Returns a request context.


getErrors(moduleGraph): WebpackError[] | null | undefined
Attributes
moduleGraph:ModuleGraph
module graph
Returns:WebpackError[] | null | undefined
errors

Returns errors.


getExports(moduleGraph): ExportsSpec | undefined
Attributes
moduleGraph:ModuleGraph
module graph
export names

Returns the exported names


getForwardId(): string | true | null
Returns:string | true | null
export name, true for all exports, null for none

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


getLazyName(): string | null
Returns:string | null
export name, null when not applicable

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


getLazyUntil(): "local" | "id" | "*" | "@" | null
Returns:"local" | "id" | "*" | "@" | null
lazy classification, null when it must be processed eagerly

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


getModuleEvaluationSideEffectsState(moduleGraph): ConnectionState
Attributes
moduleGraph:ModuleGraph
the module graph
how this dependency connects the module to referencing modules

Gets module evaluation side effects state.


getNumberOfIdOccurrences(): number
Returns:number
count how often the id is used in this dependency

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


getReference(moduleGraph): never
Attributes
moduleGraph:ModuleGraph
module graph
Returns:never
throws error

Returns the referenced module and export


getReferencedExports(moduleGraph, runtime): (string[] | ReferencedExport)[]
Attributes
moduleGraph:ModuleGraph
module graph
runtime:RuntimeSpec
the runtime for which the module is analysed
Returns:(string[] | ReferencedExport)[]
referenced exports

Returns list of exports referenced by this dependency


getResourceIdentifier(): string | null
Returns:string | null
an identifier to merge equal requests

Returns an identifier to merge equal requests.


getWarnings(moduleGraph): WebpackError[] | null | undefined
Attributes
moduleGraph:ModuleGraph
module graph
Returns:WebpackError[] | null | undefined
warnings

Returns warnings.


isLazy(): boolean
Returns:boolean
true while deferred, so it must not be processed or rendered

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


serialize(objectSerializerContextObjectMiddlewareObject_5): void
Attributes
objectSerializerContextObjectMiddlewareObject_5:ObjectSerializerContextObjectMiddlewareObject_5
Returns:void

Serializes this instance into the provided serializer context.


setLazy(value): void
Attributes
value:boolean
true to defer, false to create it now
Returns:void

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


setLoc(startLine, startColumn, endLine, endColumn): void
Attributes
startLine:number
start line
startColumn:number
start column
endLine:number
end line
endColumn:number
end column
Returns:void

Updates loc using the provided start line.


setLocWithIndex(loc, index): void
Attributes
source location (start/end/name read from it)
index:number
dependency index within the statement
Returns:void

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.


updateHash(hash, context): void
Attributes
hash:Hash
hash to be updated
Returns:void

Updates the hash with the data contributed by this instance.


Attributes
dependency:Dependency
dep
Returns:boolean
true if this dependency supports concatenation

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


Attributes
first dependency
second dependency
Returns:-1 | 0 | 1
compare result

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.


Attributes
dependency:Dependency
dep
Returns:boolean
true if the dependency is a low priority dependency

Returns true if the dependency is a low priority dependency.