Skip to content

Commit 755fe7d

Browse files
committed
refactor
1 parent dca0b68 commit 755fe7d

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

lib/Compilation.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,8 +1869,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
18691869
this.moduleGraph.setParents(dep, currentBlock, module, index);
18701870
if (
18711871
hasLazyBarrel &&
1872-
// `isLazy` may be missing on custom dependency types not extending the base Dependency
1873-
typeof dep.isLazy === "function" &&
1872+
// TODO remove in webpack 6
1873+
// It may be missing on custom dependency types not extending the base Dependency
1874+
"isLazy" in dep &&
18741875
dep.isLazy()
18751876
) {
18761877
return;

lib/LazyBarrel.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ function getForwardedIds(dependencies) {
4545
/** @type {Set<string>} */
4646
const ids = new Set();
4747
for (const dependency of dependencies) {
48+
// TODO remove in webpack 6
49+
// It may be missing on custom dependency types not extending the base Dependency
50+
if (!("getForwardId" in dependency)) continue;
51+
4852
const id = dependency.getForwardId();
4953
if (id === true) return true;
5054
if (id !== null) ids.add(id);
@@ -201,6 +205,10 @@ class LazyBarrelController {
201205
/** @type {LazyBarrelInfo | undefined} */
202206
let info;
203207
for (const dep of module.dependencies) {
208+
// TODO remove in webpack 6
209+
// It may be missing on custom dependency types not extending the base Dependency
210+
if (!("getLazyUntil" in dep && "setLazy" in dep)) continue;
211+
204212
const until = dep.getLazyUntil();
205213
if (until === null) continue;
206214
if (info === undefined) info = new LazyBarrelInfo();

0 commit comments

Comments
 (0)