-
Notifications
You must be signed in to change notification settings - Fork 27.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add partial support for "use cache"
in metadata route handlers
#74835
Conversation
Tests Passed |
Stats from current PRDefault BuildGeneral
Client Bundles (main, webpack)
Legacy Client Bundles (polyfills)
Client Pages
Client Build Manifests
Rendered Page Sizes
Edge SSR bundle Size
Middleware size
Next Runtimes
build cache
Diff detailsDiff for main-HASH.jsDiff too large to display Diff for server.runtime.prod.jsDiff too large to display |
48b39dc
to
e9e182d
Compare
@@ -1309,6 +1309,12 @@ export default async function getBaseWebpackConfig( | |||
}, | |||
], | |||
}, | |||
resourceQuery: { | |||
not: [ | |||
new RegExp(WEBPACK_RESOURCE_QUERIES.metadata), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 sounds fine to keep as RSC like layers, curious why we need to change them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They will still be in the RSC layer (via issuer layer), but we don't want to apply the next-flight-loader
to them, as that would generate additional and conflicting entries, which are already covered by the next-metadata-route-loader
entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this exclusion, we would generate duplicate export statements like these:
export { $$RSC_SERVER_CACHE_0 as "8056ace5d0b6cd298fba2780df50a7ec233c33eeef" } from "<snip>/app/opengraph-image.tsx?__next_metadata__"
export { $$RSC_SERVER_CACHE_0 as "8056ace5d0b6cd298fba2780df50a7ec233c33eeef" } from "<snip>/app/opengraph-image.tsx?__next_metadata_image_meta__"
I've pushed a (hopefully) clarifying comment.
connection.dependency as unknown as webpack.NormalModule | ||
).request | ||
|
||
if (entryRequest.endsWith(WEBPACK_RESOURCE_QUERIES.metadataRoute)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking: would be nice to have a helper to extract entryRequest and handle all cases, using let
scares me that we might need to take care of these cases everywhere when we create them.
…74876) Fixes a regression caused by #74835. [x-ref](https://github.com/vercel/next.js/actions/runs/12773698779/job/35607288377)
Adds support for using
"use cache"
in the special metadata route handlers likesitemap.ts
,opengraph-image.tsx
,icon.tsx
, and other metadata files.reverts #71225
fixes #74146
closes NAR-51
As a follow-up we need to ensure that opengraph image responses do not bail out of static generation when
dynamicIO
is enabled.