Unverified Commit 856dc4f0 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update parallel routes in build-complete (#85546)

This fixes parallel routes being considered separate outputs with the
same pathname in the adapters build-complete hook and instead merges
them into the same output combining the necessary outputs.
parent 137dbec7
...@@ -966,6 +966,18 @@ export async function handleBuildComplete({ ...@@ -966,6 +966,18 @@ export async function handleBuildComplete({
return {} as Record<string, string> return {} as Record<string, string>
} }
) )
// If this is a parallel route we just need to merge
// the assets as they share the same pathname
const existingOutput = appOutputMap[normalizedPage]
if (existingOutput) {
Object.assign(existingOutput.assets, assets)
existingOutput.assets[path.relative(tracingRoot, pageFile)] =
pageFile
continue
}
const functionConfig = const functionConfig =
functionsConfigManifest.functions[normalizedPage] || {} functionsConfigManifest.functions[normalizedPage] || {}
......
...@@ -23,6 +23,9 @@ describe('adapter-config export', () => { ...@@ -23,6 +23,9 @@ describe('adapter-config export', () => {
'pages/api/node-pages.ts', 'pages/api/node-pages.ts',
'pages/edge-pages/index.tsx', 'pages/edge-pages/index.tsx',
'pages/node-pages/index.tsx', 'pages/node-pages/index.tsx',
'app/node-app/[slug]/page.tsx',
'app/node-app/@dialog/default.tsx',
'app/node-app/@dialog/[slug]/page.tsx',
] ]
for (const file of nonExportFiles) { for (const file of nonExportFiles) {
......
export default function Page() {
return (
<>
<p>@dialog parallel route for /node-app/[slug]</p>
</>
)
}
export default function Page() {
return 'default dialog'
}
export default function Page() {
return <>/node-app/[slug]</>
}
export default function Layout({ dialog, children }: any) {
return (
<>
{dialog}
{children}
</>
)
}
...@@ -5,6 +5,7 @@ import fs from 'fs' ...@@ -5,6 +5,7 @@ import fs from 'fs'
const myAdapter = { const myAdapter = {
name: 'my-custom-adapter', name: 'my-custom-adapter',
modifyConfig: (config, { phase }) => { modifyConfig: (config, { phase }) => {
if (process.env.NODE_ENV !== 'production') return config
if (typeof phase !== 'string') { if (typeof phase !== 'string') {
throw new Error(`invalid phase value provided to modifyConfig ${phase}`) throw new Error(`invalid phase value provided to modifyConfig ${phase}`)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment