On this page

A Chunk is a unit of encapsulation for Modules. Chunks are "rendered" into bundles that get emitted when the build completes.

new Chunk(name?, backCompat?): Chunk
Attributes
name:string | null
of chunk being created, is optional (for subclasses)
backCompat:boolean
enable backward-compatibility
Returns:Chunk

Creates an instance of Chunk.

Attributes
auxiliaryFiles:Set<string>
chunkReason:string
contentHash:Record<string, string>
cssFilenameTemplate:string | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string)
debugId:number
Defines the chunk module maps type used by this module.
entryModule:Module
Returns entry module.
extraAsync:boolean
filenameTemplate:string | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string)
files:Set<string>
groupsIterable:SortableSet<ChunkGroup>
Gets groups iterable.
hash:string
id:string | number | null
idNameHints:SortableSet<string>
ids:ChunkId[] | null
modulesIterable:Iterable<Module>
name:string | null
preventIntegration:boolean
rendered:boolean
renderedHash:string
runtime:RuntimeSpec
addGroup(chunkGroup): void
Attributes
chunkGroup:ChunkGroup
the chunkGroup the chunk is being added
Returns:void

Adds the provided chunk group to the chunk.


addModule(module): boolean
Attributes
module:Module
the module
Returns:boolean
true, if the chunk could be added

Adds the provided module to the chunk.


canBeInitial(): boolean
Returns:boolean
whether or not this chunk can be an initial chunk

Checks whether it can be initial.


canBeIntegrated(otherChunk): boolean
Attributes
otherChunk:Chunk
the other chunk
Returns:boolean
true, if chunks could be integrated

Checks whether this chunk can be integrated with another chunk.


compareTo(otherChunk): -1 | 0 | 1
Attributes
otherChunk:Chunk
the chunk to compare with
Returns:-1 | 0 | 1
the comparison result

Compares this chunk with another chunk.


containsModule(module): boolean
Attributes
module:Module
the module
Returns:boolean
true, if the chunk contains the module

Checks whether this chunk contains the module.


disconnectFromGroups(): void
Returns:void

Disconnects from groups.


getAllAsyncChunks(): Set<Chunk>
Returns:Set<Chunk>
a set of all the async chunks

Gets all async chunks.


getAllInitialChunks(): Set<Chunk>
Returns:Set<Chunk>
a set of all the initial chunks (including itself)

Gets all initial chunks.


getAllReferencedAsyncEntrypoints(): Set<Entrypoint>
Returns:Set<Entrypoint>
a set of all the referenced entrypoints

Gets all referenced async entrypoints.


getAllReferencedChunks(): Set<Chunk>
Returns:Set<Chunk>
a set of all the referenced chunks (including itself)

Gets all referenced chunks.


getChildIdsByOrders(chunkGraph, filterFn?): Record<string, ChunkId[]>
Attributes
chunkGraph:ChunkGraph
the chunk graph
filterFn:(c: Chunk, chunkGraph: ChunkGraph) => boolean
function used to filter chunks
Returns:Record<string, ChunkId[]>
a record object of names to lists of child ids(?)

Gets child ids by orders.


getChildIdsByOrdersMap(chunkGraph, includeDirectChildren?, filterFn?): ChunkChildIdsByOrdersMapByData
Attributes
chunkGraph:ChunkGraph
the chunk graph
includeDirectChildren:boolean
include direct children (by default only children of async children are included)
filterFn:(c: Chunk, chunkGraph: ChunkGraph) => boolean
function used to filter chunks
a record object of names to lists of child ids(?) by chunk id

Gets child ids by orders map.


getChildrenOfTypeInOrder(chunkGraph, type): ChunkChildOfTypeInOrder[] | undefined
Attributes
chunkGraph:ChunkGraph
the chunk graph
type:string
option name
referenced chunks for a specific type

Gets children of type in order.


getChunkMaps(realHash): ChunkMaps
Attributes
realHash:boolean
whether the full hash or the rendered hash is to be used
Returns:ChunkMaps
the chunk map information

Returns the chunk map information.


getChunkModuleMaps(filterFn): ChunkModuleMaps
Attributes
filterFn:(m: Module) => boolean
function used to filter modules
module map information

Gets chunk module maps.


getEntryOptions(): EntryOptions | undefined
the entry options for this chunk

Gets entry options.


getModules(): Module[]
Returns:Module[]
the modules for this chunk

Returns the modules for this chunk.


getNumberOfGroups(): number
Returns:number
the amount of groups that the said chunk is in

Gets number of groups.


getNumberOfModules(): number
Returns:number
the number of module which are contained in this chunk

Gets the number of modules in this chunk.


hasAsyncChunks(): boolean
Returns:boolean
true, if the chunk references async chunks

Checks whether this chunk has async chunks.


hasChildByOrder(chunkGraph, type, includeDirectChildren?, filterFn?): boolean
Attributes
chunkGraph:ChunkGraph
the chunk graph
type:string
option name
includeDirectChildren:boolean
include direct children (by default only children of async children are included)
filterFn:(c: Chunk, chunkGraph: ChunkGraph) => boolean
function used to filter chunks
Returns:boolean
true when the child is of type order, otherwise false

Checks whether this chunk contains the chunk graph.


hasEntryModule(): boolean
Returns:boolean
true, if the chunk contains an entry module

Checks whether this chunk has an entry module.


hasModuleInGraph(filterFn, filterChunkFn?): boolean
Attributes
filterFn:(m: Module) => boolean
predicate function used to filter modules
filterChunkFn:(c: Chunk, chunkGraph: ChunkGraph) => boolean
predicate function used to filter chunks
Returns:boolean
return true if module exists in graph

Checks whether this chunk contains a matching module in the graph.


hasRuntime(): boolean
Returns:boolean
whether or not the Chunk will have a runtime

Checks whether this chunk has runtime.


integrate(otherChunk): boolean
Attributes
otherChunk:Chunk
the other chunk
Returns:boolean
true, if the specified chunk has been integrated

Integrates another chunk into this chunk when possible.


integratedSize(otherChunk, options): number
Attributes
otherChunk:Chunk
the other chunk
options object
Returns:number
total size of the chunk or false if the chunk can't be integrated

Returns the integrated size with another chunk.


isEmpty(): boolean
Returns:boolean
true, if this chunk contains no module

Checks whether this chunk is empty.


isInGroup(chunkGroup): boolean
Attributes
chunkGroup:ChunkGroup
the chunkGroup to check
Returns:boolean
returns true if chunk has chunkGroup reference and exists in chunkGroup

Checks whether this chunk is in group.


isOnlyInitial(): boolean
Returns:boolean
whether this chunk can only be an initial chunk

Checks whether this chunk is only initial.


modulesSize(): number
Returns:number
total size of all modules in this chunk

Returns the total size of all modules in this chunk.


moveModule(module, otherChunk): void
Attributes
module:Module
the module
otherChunk:Chunk
the target chunk
Returns:void

Moves a module from this chunk to another chunk.


remove(): void
Returns:void

Removes this chunk from the chunk graph and chunk groups.


removeGroup(chunkGroup): void
Attributes
chunkGroup:ChunkGroup
the chunkGroup the chunk is being removed from
Returns:void

Removes the provided chunk group from the chunk.


removeModule(module): void
Attributes
module:Module
the module
Returns:void

Removes the provided module from the chunk.


size(options?): number
Attributes
options object
Returns:number
total size of this chunk

Returns the estimated size for the requested source type.


split(newChunk): void
Attributes
newChunk:Chunk
the new chunk that will be split out of
Returns:void

Processes the provided new chunk.


updateHash(hash, chunkGraph): void
Attributes
hash:Hash
hash (will be modified)
chunkGraph:ChunkGraph
the chunk graph
Returns:void

Updates the hash with the data contributed by this instance.