Skip to content

Commit a2b4bf4

Browse files
committed
Fix options not being picked up by ChunkCollector on entry and polyfill module
1 parent 2968ab2 commit a2b4bf4

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/collector.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ export class ChunkCollector {
2626
modulesIds = new Set<string>();
2727
preloads = new Map<string, Preload>();
2828

29-
preloadFonts = true;
30-
preloadAssets = false;
31-
asyncScript = false;
32-
nonce: string;
33-
3429
constructor(
3530
public manifest: Manifest,
36-
public entry: string
31+
public entry: string,
32+
public preloadFonts = true,
33+
public preloadAssets = false,
34+
public nonce = '',
35+
public asyncScript = false
3736
) {
3837
this.__context_collectModuleId =
3938
this.__context_collectModuleId.bind(this);
@@ -206,11 +205,14 @@ export function createChunkCollector(options: CollectorOptions) {
206205
}
207206
}
208207

209-
const collector = new ChunkCollector(manifest, entry);
210-
collector.preloadAssets = options.preloadAssets || false;
211-
collector.preloadFonts = options.preloadFonts ?? true;
212-
collector.nonce = options.nonce!;
213-
collector.asyncScript = options.asyncScript || false;
208+
const collector = new ChunkCollector(
209+
manifest,
210+
entry,
211+
options.preloadFonts,
212+
options.preloadAssets,
213+
options.nonce,
214+
options.asyncScript
215+
);
214216
return collector;
215217
}
216218

@@ -243,8 +245,8 @@ function collectModules(
243245
}: ChunkCollector
244246
) {
245247
// The reported module ID is not in it's own chunk
248+
// Possible cause for the missing module in the manifest is build.rollupOptions.output.experimentalMinChunkSize
246249
if (!manifest[moduleId] || preloads.has(moduleId)) {
247-
console.log('Module ID is not in its own chunk', moduleId);
248250
return preloads;
249251
}
250252

0 commit comments

Comments
 (0)