On this page

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

Attributes
new Chunk(name?, backCompat?): Chunk
Attributes
of chunk being created, is optional (for subclasses)
backCompat:<boolean>
enable backward-compatibility
Returns:<Chunk>
addGroup(chunkGroup): void
Attributes
chunkGroup:<ChunkGroup>
the chunkGroup the chunk is being added
Returns:
{void}

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

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

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

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

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

disconnectFromGroups(): void
Returns:
{void}

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

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

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

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

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

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:<object>
function used to filter chunks
Returns:
{ChunkChildIdsByOrdersMapByData} a record object of names to lists of child ids(?) by chunk id

getChildrenOfTypeInOrder(chunkGraph, type): undefined
Attributes
chunkGraph:<ChunkGraph>
the chunk graph
option name
Returns:<undefined>
referenced chunks for a specific type

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

getChunkModuleMaps(filterFn): ChunkModuleMaps
Attributes
filterFn:<object>
function used to filter modules
Returns:
{ChunkModuleMaps} module map information

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

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

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

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

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

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

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

hasModuleInGraph(filterFn, filterChunkFn?): boolean
Attributes
filterFn:<object>
predicate function used to filter modules
filterChunkFn:<object>
predicate function used to filter chunks
Returns:<boolean>
return true if module exists in graph

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

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

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

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

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

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

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

moveModule(module, otherChunk): void
Attributes
module:<Module>
the module
otherChunk:<Chunk>
the target chunk
Returns:
{void}

remove(): void
Returns:
{void}

removeGroup(chunkGroup): void
Attributes
chunkGroup:<ChunkGroup>
the chunkGroup the chunk is being removed from
Returns:
{void}

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

size(options?): void
  • options {ChunkSizeOptions} options object
  • Returns: <number> total size of this chunk

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

updateHash(hash, chunkGraph): void
  • hash {Hash} hash (will be modified)
  • chunkGraph <ChunkGraph> the chunk graph
  • Returns: {void}