Skip to content

Commit 1d41d26

Browse files
committed
logs
1 parent 0652151 commit 1d41d26

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/client/utils/sanitize.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ const constructTree = (routes: any, parentId?: string): RawNodeDatum[] => {
5858
const routeKeys = Object.keys(routes)
5959
for (const key of routeKeys) {
6060
const route = routes[key]
61+
// biome-ignore lint/suspicious/noConsole: <explanation>
62+
console.log({
63+
key,
64+
route,
65+
parentId,
66+
})
6167
if (route.parentId === parentId) {
6268
const url = convertReactRouterPathToUrl(routes, route)
6369
const node: RawNodeDatum = {
@@ -78,6 +84,8 @@ const constructTree = (routes: any, parentId?: string): RawNodeDatum[] => {
7884
}
7985

8086
export const createRouteTree = (routes: RouteManifest | undefined) => {
87+
// biome-ignore lint/suspicious/noConsole: <explanation>
88+
console.log("createRouteTree", routes)
8189
return constructTree(routes)
8290
}
8391

src/vite/plugin.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,17 @@ export const reactRouterDevTools: (args?: ReactRouterViteConfig) => Plugin[] = (
7878
}
7979

8080
const isRoute = id.includes(`${appDirName}/root`) || flatRoutes.some((route) => id.endsWith(route.file))
81+
// biome-ignore lint/suspicious/noConsole: <explanation>
82+
console.log("isRoute", isRoute, id)
8183
if (!isRoute) {
8284
return
8385
}
8486

85-
const routeId = id.replace(normalizePath(process.cwd()), "").replace(`/${appDirName}/`, "").replace(".tsx", "")
87+
const routeId = id
88+
.replace(normalizePath(process.cwd()), "")
89+
.replace(`/${appDirName}/`, "")
90+
.replace(".tsx", "")
91+
.replace(".ts", "")
8692
return routeId
8793
}
8894
// Set the server config on the process object so that it can be accessed by the plugin

0 commit comments

Comments
 (0)