From 575385efdfd7b53e61f5e0626237f35ee0d335e3 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Wed, 14 Aug 2024 16:10:47 +0200 Subject: [PATCH] Fix bad modRequest in flight entry manifest (#68888) ### What While going through the logic of flight manifest, found the `modRequest` sometimes accidentally become `"undefined"` string due to composing with another potential undefined value. This caused extra traversal, fixing this will improve a bit on the performance. --- .../src/build/webpack/plugins/flight-client-entry-plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts b/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts index 932c5356c3e04..9b0f6ef7f24d6 100644 --- a/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts +++ b/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts @@ -644,11 +644,11 @@ export class FlightClientEntryPlugin { const isCSS = isCSSMod(mod) const modPath: string = mod.resourceResolveData?.path || '' + const modQuery = mod.resourceResolveData?.query || '' // We have to always use the resolved request here to make sure the // server and client are using the same module path (required by RSC), as // the server compiler and client compiler have different resolve configs. - let modRequest: string | undefined = - modPath + mod.resourceResolveData?.query + let modRequest: string = modPath + modQuery // Context modules don't have a resource path, we use the identifier instead. if (mod.constructor.name === 'ContextModule') {