Skip to content

Commit d83fb11

Browse files
committed
fix
1 parent e55836d commit d83fb11

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/vite/plugin.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,13 @@ export const reactRouterDevTools: (args?: ReactRouterViteConfig) => Plugin[] = (
126126
}
127127
return [routeOrRoutes]
128128
}
129-
flatRoutes = routes.map((route) => ({ ...route, parentId: "root" })).flatMap(recursiveFlatten)
129+
flatRoutes = routes
130+
.map((route) => {
131+
const withoutExtension = route.file.split(".").slice(0, -1).join(".")
132+
const withoutRelative = withoutExtension.replace(/^\.\//, "").replace(/^\.\.\//, "")
133+
return { ...route, parentId: "root", id: route.id ?? withoutRelative }
134+
})
135+
.flatMap(recursiveFlatten)
130136
} catch (e) {}
131137
const reactRouterIndex = resolvedViteConfig.plugins.findIndex((p) => p.name === "react-router")
132138
const devToolsIndex = resolvedViteConfig.plugins.findIndex((p) => p.name === "react-router-devtools")

0 commit comments

Comments
 (0)