mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
88c05db494
Extracted from https://github.com/vercel/next.js/pull/95468 and arguably the main fix there. We need to add code to wait for top-level awaits in two cases: - If a metadata module (like `opengraph-image.tsx`) is slow to evaluate, cache warming wouldn't "wait" for it, and then the actual build would fail with `Unexpected cache miss after cache warming phase`. This is fixed with placing `instrumentModuleGetter` around them. - If the evaluation is fast but still async (e.g. `await readFile` on a large font), the build passes but the segment collector reads the module too early, doesn't see `generateStaticParams`, and so the image becomes dynamic instead of prerendered. The fix is `await ensureUserland` before looking at exports. Remaining callsites are wrapped so we don't add more bugs like this, but it's not strictly required now because they are already being awaited elsewhere. I've done this for consistency. New tests fail before the fix.
2 lines
12 B
Plaintext
2 lines
12 B
Plaintext
Second Post
|