File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 66
77const ChunkGroup = require ( "./ChunkGroup" ) ;
88
9+ /** @typedef {import("./Chunk.js") } Chunk */
10+
11+ /**
12+ * Entrypoint serves as an encapsulation primitive for chunks that are
13+ * a part of a single ChunkGroup. They represent all bundles that need to be loaded for a
14+ * single instance of a page. Multi-page application architectures will typically yield multiple Entrypoint objects
15+ * inside of the compilation, whereas a Single Page App may only contain one with many lazy-loaded chunks.
16+ */
917class Entrypoint extends ChunkGroup {
18+ /**
19+ * Creates an instance of Entrypoint.
20+ * @param {string } name the name of the entrypoint
21+ */
1022 constructor ( name ) {
1123 super ( name ) ;
24+ /** @type {Chunk= } */
1225 this . runtimeChunk = undefined ;
1326 }
1427
28+ /**
29+ * isInitial will always return true for Entrypoint ChunkGroup.
30+ * @return {true } returns true as all entrypoints are initial ChunkGroups
31+ */
1532 isInitial ( ) {
1633 return true ;
1734 }
1835
36+ /**
37+ * Sets the runtimeChunk for an entrypoint.
38+ * @param {Chunk } chunk the chunk being set as the runtime chunk.
39+ * @return {void }
40+ */
1941 setRuntimeChunk ( chunk ) {
2042 this . runtimeChunk = chunk ;
2143 }
2244
45+ /**
46+ * Fetches the chunk reference containing the webpack bootstrap code
47+ * @return {Chunk } returns the runtime chunk or first chunk in `this.chunks`
48+ */
2349 getRuntimeChunk ( ) {
2450 return this . runtimeChunk || this . chunks [ 0 ] ;
2551 }
You can’t perform that action at this time.
0 commit comments