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] = {