mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
## Summary This fixes adapter `onBuildComplete` outputs for dynamic metadata routes. ## Bug `handleBuildComplete` skipped metadata routes too aggressively via `isStaticMetadataFile(...)`, so dynamic metadata routes (for example `robots.txt` / `sitemap.xml` using `connection()`) were omitted from `outputs.appRoutes`. ## Fix Only skip metadata routes when they are actually prerendered/static (present in prerender manifests). Dynamic metadata routes are now included in adapter `outputs.appRoutes` as expected. ## Tests Added e2e coverage in `test/e2e/app-dir/adapter-dynamic-metadata`: - verifies dynamic `robots.txt`, `sitemap.xml`, and `favicon.ico` functionality - verifies adapter output classification for non-deploy runs - skips output-shape verification in deploy mode - skips the suite in dev mode
15 lines
287 B
JavaScript
15 lines
287 B
JavaScript
import fs from 'fs'
|
|
|
|
/** @type {import('next').NextAdapter} */
|
|
const adapter = {
|
|
name: 'adapter-dynamic-metadata',
|
|
onBuildComplete: async (ctx) => {
|
|
await fs.promises.writeFile(
|
|
'build-complete.json',
|
|
JSON.stringify(ctx, null, 2)
|
|
)
|
|
},
|
|
}
|
|
|
|
export default adapter
|