diff --git a/.changeset/silly-fishes-try.md b/.changeset/silly-fishes-try.md new file mode 100644 index 0000000000..d049873c00 --- /dev/null +++ b/.changeset/silly-fishes-try.md @@ -0,0 +1,5 @@ +--- +"@react-router/dev": minor +--- + +Fix: decode Windows paths in dev mode to prevent ENOENT diff --git a/contributors.yml b/contributors.yml index 9927f078ff..35b5507e5f 100644 --- a/contributors.yml +++ b/contributors.yml @@ -427,3 +427,4 @@ - zeromask1337 - zheng-chuang - zxTomw +- drewkovihair \ No newline at end of file diff --git a/packages/react-router-dev/vite/plugin.ts b/packages/react-router-dev/vite/plugin.ts index 501a8a11e1..42a62c921b 100644 --- a/packages/react-router-dev/vite/plugin.ts +++ b/packages/react-router-dev/vite/plugin.ts @@ -3650,7 +3650,9 @@ export async function getEnvironmentOptionsResolvers( let isRootRoute = route.file === ctx.reactRouterConfig.routes.root.file; - let code = readFileSync(routeFilePath, "utf-8"); + let cleanPath = path.normalize(decodeURIComponent(routeFilePath)); + let code = readFileSync(cleanPath, "utf-8"); + return [ `${routeFilePath}${BUILD_CLIENT_ROUTE_QUERY_STRING}`,