Skip to content

Commit 28803f0

Browse files
authored
fix: Make file route HMR work on Windows (#2978) (CP: 24.5) (#2981)
Fixes #2964
1 parent e2c6ea1 commit 28803f0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/ts/file-router/src/vite-plugin.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ export default function vitePluginFileSystemRouter({
115115
},
116116
transform(code, id): Promise<TransformResult> | TransformResult {
117117
let modifiedCode = code;
118-
if (id.startsWith(fileURLToPath(_viewsDir)) && !basename(id).startsWith('_')) {
118+
const viewsDirUsingSlashes = fileURLToPath(_viewsDir).replaceAll('\\', '/');
119+
if (id.startsWith(viewsDirUsingSlashes) && !basename(id).startsWith('_')) {
119120
if (isDevMode) {
120121
// To enable HMR for route files with exported configurations, we need
121122
// to address a limitation in `react-refresh`. This library requires

0 commit comments

Comments
 (0)