Skip to content

Commit

Permalink
perf: merge app metadata route and rsc layer (#71167)
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi authored Nov 1, 2024
1 parent 5d3bc2b commit e8421c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions packages/next/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
/**
Expand Down Expand Up @@ -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 =
Expand All @@ -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,
],
Expand All @@ -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,
Expand Down

0 comments on commit e8421c5

Please sign in to comment.