File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff 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" )
You can’t perform that action at this time.
0 commit comments