From d88796fa27734a0f481bad665b2f0893abf898f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Born=C3=B6?= Date: Thu, 24 Nov 2022 15:45:00 +0100 Subject: [PATCH] Check for backslash in chunk group name --- .../next/build/webpack/plugins/flight-manifest-plugin.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/next/build/webpack/plugins/flight-manifest-plugin.ts b/packages/next/build/webpack/plugins/flight-manifest-plugin.ts index 00aefb985d64..7f0cd6476388 100644 --- a/packages/next/build/webpack/plugins/flight-manifest-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-manifest-plugin.ts @@ -274,7 +274,10 @@ export class FlightManifestPlugin { moduleExportedKeys.forEach((name) => { // If the chunk is from `app/` chunkGroup, use it first. // This make sure not to load the overlapped chunk from `pages/` chunkGroup - if (!moduleExports[name] || chunkGroup.name?.startsWith('app/')) { + if ( + !moduleExports[name] || + (chunkGroup.name && /^app[\\/]/.test(chunkGroup.name)) + ) { const requiredChunks = getAppPathRequiredChunks() moduleExports[name] = {