Skip to content

Commit 53f70c7

Browse files
committed
deprecate chunk.chunks
1 parent 81e5b7c commit 53f70c7

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎lib/Chunk.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ class Chunk {
6161
throw new Error("Chunk.initial was removed. Use isInitial()");
6262
}
6363

64+
/**
65+
* @return {Set} - a set containing the chunks
66+
*/
67+
getChunks() {
68+
return this._chunks;
69+
}
70+
6471
hasRuntime() {
6572
if(this.entrypoints.length === 0) return false;
6673
return this.entrypoints[0].chunks[0] === this;
@@ -466,4 +473,14 @@ Object.defineProperty(Chunk.prototype, "modules", {
466473
}, "Chunk.modules is deprecated. Use Chunk.addModule/removeModule instead.")
467474
});
468475

476+
Object.defineProperty(Chunk.prototype, "chunks", {
477+
configurable: false,
478+
get: util.deprecate(function() {
479+
return Array.from(this._chunks);
480+
}, "Chunk.chunks: Use Chunk.getChunks() instead"),
481+
set() {
482+
throw new Error("Readonly. Use Chunk.addChunk/removeChunk/getChunks to access/modify chunks.");
483+
}
484+
});
485+
469486
module.exports = Chunk;

0 commit comments

Comments
 (0)