Files
Niklas MischkulnigandGitHub d6794f43c1 Turbopack: throw large static metadata error earlier (#82939)
Throw it during bundling, as opposed to at runtime.

This circumnavigates a panic in Turbopack when inlining a 40mb string into a JS module.
2025-08-25 11:09:45 +02:00

24 lines
857 B
TypeScript

import { nextTestSetup } from 'e2e-utils'
import { generatePNG } from '../generate-image'
describe('app-dir - metadata-img-too-large opengraph-image', () => {
const { next, isTurbopack } = nextTestSetup({
files: __dirname,
skipStart: true,
})
const pngFile = generatePNG(8)
it('should throw when opengraph-image file size exceeds 8MB', async () => {
await next.patchFile('app/opengraph-image.png', pngFile as any)
await next.build()
const regex = isTurbopack
? // in Turbopack, the path is simplified as [project]/.... It's also thrown earlier, so the prefix is slightly different.
/File size for Open Graph image "\[project\]\/app\/opengraph-image\.png" exceeds 8MB/
: /Error: File size for Open Graph image ".*\/app\/opengraph-image\.png" exceeds 8MB/
expect(next.cliOutput).toMatch(regex)
})
})