Files
next.js/test/e2e/app-dir/metadata-dynamic-routes-async-deps/index.test.ts
Niklas MischkulnigandGitHub 118bdaf68c Turbopack: lazy require metadata and handle TLA (#91705)
A regression from #88487

1. Make metadata import lazy with `() => require()`, just like for the layout segments
2. Properly await the return value to better handle TLA modules

This align with Webpack which does this:

<img width="1535" height="509" alt="Bildschirmfoto 2026-03-20 um 11 58 00" src="https://github.com/user-attachments/assets/f2864c86-ccce-4884-8417-c8ae06c05f78" />


Closes PACK-6927
Closes #91700
Closes https://github.com/vercel/next.js/issues/91676
2026-03-20 16:30:32 +01:00

23 lines
792 B
TypeScript

import { nextTestSetup } from 'e2e-utils'
describe('app dir - metadata dynamic routes with async deps', () => {
const { next } = nextTestSetup({
files: __dirname,
dependencies: {
'@vercel/og': 'latest',
},
})
it('should render page with og:image meta tag when opengraph-image has async dependencies', async () => {
const $ = await next.render$('/blog/hello-world')
const ogImageUrl = $('meta[property="og:image"]').attr('content')
expect(ogImageUrl).toContain('/blog/hello-world/opengraph-image')
})
it('should serve the opengraph-image route as a valid image', async () => {
const res = await next.fetch('/blog/hello-world/opengraph-image')
expect(res.status).toBe(200)
expect(res.headers.get('content-type')).toBe('image/png')
})
})