Unverified Commit 5261ed8d authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Turbopack Build: Fix /index/index handling (#80413)

## What?

Alternative for #80385
parent fba3b9b0
......@@ -478,22 +478,29 @@ export class TurbopackManifestLoader {
}
const sortedPageKeys = getSortedRoutes(pagesKeys)
const content: ClientBuildManifest = {
const clientBuildManifest: ClientBuildManifest = {
__rewrites: normalizeRewritesForBuildManifest(rewrites) as any,
...Object.fromEntries(
sortedPageKeys.map((pathname) => [
pathname,
[`static/chunks/pages${pathname === '/' ? '/index' : pathname}.js`],
])
sortedPageKeys.map((pathname) => {
let filePath
if (pathname === '/') {
filePath = '/index.js'
} else if (pathname.endsWith('/index')) {
filePath = `${pathname}/index.js`
} else {
filePath = `${pathname}.js`
}
return [pathname, [`static/chunks/pages${filePath}`]]
})
),
sortedPages: sortedPageKeys,
}
const buildManifestJs = `self.__BUILD_MANIFEST = ${JSON.stringify(
content
const clientBuildManifestJs = `self.__BUILD_MANIFEST = ${JSON.stringify(
clientBuildManifest
)};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`
await writeFileAtomic(
join(this.distDir, 'static', this.buildId, '_buildManifest.js'),
buildManifestJs
clientBuildManifestJs
)
await writeFileAtomic(
join(this.distDir, 'static', this.buildId, '_ssgManifest.js'),
......
......@@ -15234,11 +15234,10 @@
"nested index.js production mode should ssr page /index",
"nested index.js production mode should ssr page /index/index",
"nested index.js production mode should ssr page /index/project",
"nested index.js production mode should ssr page /index/user"
],
"failed": [
"nested index.js production mode should ssr page /index/user",
"nested index.js production mode should follow link to /index/index"
],
"failed": [],
"pending": [
"nested index.js development mode should 404 on /index/index/index",
"nested index.js development mode should client render page /",
......@@ -16895,11 +16894,10 @@
},
"test/integration/prerender-export/test/index.test.js": {
"passed": [
"SSG Prerender export production mode export mode should copy prerender files and honor exportTrailingSlash"
],
"failed": [
"SSG Prerender export production mode export mode should copy prerender files and honor exportTrailingSlash",
"SSG Prerender export production mode export mode should navigate between pages successfully"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
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