diff --git a/src/debug/loadLazyChunks.ts b/src/debug/loadLazyChunks.ts index b7a8fbc6..6923d3a2 100644 --- a/src/debug/loadLazyChunks.ts +++ b/src/debug/loadLazyChunks.ts @@ -27,7 +27,12 @@ export async function loadLazyChunks() { const LazyChunkRegex = canonicalizeMatch(/(?:(?:Promise\.all\(\[)?(\i\.e\("?[^)]+?"?\)[^\]]*?)(?:\]\))?)\.then\(\i\.bind\(\i,"?([^)]+?)"?\)\)/g); + const foundCssDebuggingLoad = false; + async function searchAndLoadLazyChunks(factoryCode: string) { + // Workaround to avoid loading the CSS debugging chunk which turns the app pink + const hasCssDebuggingLoad = foundCssDebuggingLoad ? false : factoryCode.includes(".cssDebuggingEnabled&&"); + const lazyChunks = factoryCode.matchAll(LazyChunkRegex); const validChunkGroups = new Set<[chunkIds: number[], entryPoint: number]>(); @@ -43,6 +48,16 @@ export async function loadLazyChunks() { let invalidChunkGroup = false; for (const id of chunkIds) { + if (hasCssDebuggingLoad) { + if (chunkIds.length > 1) { + throw new Error("Found multiple chunks in factory that loads the CSS debugging chunk"); + } + + invalidChunks.add(id); + invalidChunkGroup = true; + break; + } + if (wreq.u(id) == null || wreq.u(id) === "undefined.js") continue; const isWorkerAsset = await fetch(wreq.p + wreq.u(id))