next.js
ee020c58 - Add failing tests for metadata image modules with top-level await

Commit
8 hours ago
Add failing tests for metadata image modules with top-level await When a metadata image route (e.g. opengraph-image.tsx) transitively becomes an async module (e.g. by loading a font at module scope with a top-level await), the async module evaluation is not tracked by the cache warming phase of the prerender: - If the module evaluation outlasts the tracked cache reads, the warming render is aborted before generateMetadata() runs, so its cache entries are never warmed. The final prerender then takes an unexpected cache miss, blocking the route's metadata and failing the build. - Even when module evaluation is fast, the image route itself silently loses its generateStaticParams prerendering and becomes fully dynamic. The new use-cache-og-image-top-level-await suite captures the build failure. The fixture stalls the module evaluation with a timer that must outlast the prerender's cache reads, and the build prerenders only the affected routes via --debug-build-paths. The extended use-cache-metadata-route-handler suite captures the missing image route prerenders.
Author
Committer
Parents
Loading