Revert "fix: catch-all server side handler"

This reverts commit 7e8be92cd5.
This commit is contained in:
Valerio Ageno
2025-01-04 10:33:52 +01:00
parent 7e8be92cd5
commit 1356be248e
3 changed files with 12 additions and 11 deletions
@@ -85,7 +85,8 @@ async function getRouteNodes(
} else if (fullPath.match(/\.(rs)$/)) { } else if (fullPath.match(/\.(rs)$/)) {
const filePath = replaceBackslash(path.join(dir, dirent.name)) const filePath = replaceBackslash(path.join(dir, dirent.name))
const filePathNoExt = removeExt(filePath) const filePathNoExt = removeExt(filePath)
let routePath = cleanPath(`/${filePathNoExt}`) || '' let routePath =
cleanPath(`/${filePathNoExt.split('.').join('/')}`) || ''
if (routePath === 'index') { if (routePath === 'index') {
routePath = '/' routePath = '/'
@@ -166,16 +167,17 @@ export async function routeGenerator(config = defaultConfig): Promise<void> {
const imports = [ const imports = [
...sortedRouteNodes.map((node) => { ...sortedRouteNodes.map((node) => {
const extension = node.filePath.endsWith('mdx') ? '.mdx' : '' const extension = node.filePath.endsWith('mdx') ? '.mdx' : ''
return `const ${node.variableName as string return `const ${
}Import = dynamic(() => import('./${replaceBackslash( node.variableName as string
removeExt( }Import = dynamic(() => import('./${replaceBackslash(
path.relative( removeExt(
path.dirname(config.generatedRouteTree), path.relative(
path.resolve(config.folderName, node.filePath), path.dirname(config.generatedRouteTree),
), path.resolve(config.folderName, node.filePath),
false,
), ),
)}${extension}'))` false,
),
)}${extension}'))`
}), }),
].join('\n') ].join('\n')
@@ -24,7 +24,6 @@ const IndexRoute = Index.update({
const PostscatchallRoute = Postscatchall.update({ const PostscatchallRoute = Postscatchall.update({
path: '/posts/[...catch_all]', path: '/posts/[...catch_all]',
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
hasHandler: true,
}) })
// Create and export the route tree // Create and export the route tree