From e8421c560394c79141c62be7ebf1aa80683fcd94 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Fri, 1 Nov 2024 21:52:02 +0100 Subject: [PATCH] perf: merge app metadata route and rsc layer (#71167) --- packages/next/src/build/webpack-config.ts | 2 +- packages/next/src/lib/constants.ts | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/next/src/build/webpack-config.ts b/packages/next/src/build/webpack-config.ts index 3fa6a051fb746..09714824c9f24 100644 --- a/packages/next/src/build/webpack-config.ts +++ b/packages/next/src/build/webpack-config.ts @@ -1311,7 +1311,7 @@ export default async function getBaseWebpackConfig( resourceQuery: new RegExp( WEBPACK_RESOURCE_QUERIES.metadataRoute ), - layer: WEBPACK_LAYERS.appMetadataRoute, + layer: WEBPACK_LAYERS.reactServerComponents, }, { // Ensure that the app page module is in the client layers, this diff --git a/packages/next/src/lib/constants.ts b/packages/next/src/lib/constants.ts index cdf9181450fea..fa5efaee99b57 100644 --- a/packages/next/src/lib/constants.ts +++ b/packages/next/src/lib/constants.ts @@ -107,7 +107,7 @@ const WEBPACK_LAYERS_NAMES = { shared: 'shared', /** * The layer for server-only runtime and picking up `react-server` export conditions. - * Including app router RSC pages and app router custom routes. + * Including app router RSC pages and app router custom routes and metadata routes. */ reactServerComponents: 'rsc', /** @@ -138,10 +138,6 @@ const WEBPACK_LAYERS_NAMES = { * The browser client bundle layer for App directory. */ appPagesBrowser: 'app-pages-browser', - /** - * The server bundle layer for metadata routes. - */ - appMetadataRoute: 'app-metadata-route', } as const export type WebpackLayerName = @@ -153,12 +149,10 @@ const WEBPACK_LAYERS = { builtinReact: [ WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser, - WEBPACK_LAYERS_NAMES.appMetadataRoute, ], serverOnly: [ WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser, - WEBPACK_LAYERS_NAMES.appMetadataRoute, WEBPACK_LAYERS_NAMES.instrument, WEBPACK_LAYERS_NAMES.middleware, ], @@ -173,7 +167,6 @@ const WEBPACK_LAYERS = { bundled: [ WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser, - WEBPACK_LAYERS_NAMES.appMetadataRoute, WEBPACK_LAYERS_NAMES.serverSideRendering, WEBPACK_LAYERS_NAMES.appPagesBrowser, WEBPACK_LAYERS_NAMES.shared,