Skip to content

Commit

Permalink
fix: Make file route HMR work on Windows (#2978) (CP: 24.5) (#2981)
Browse files Browse the repository at this point in the history
Fixes #2964
  • Loading branch information
vaadin-bot authored Dec 10, 2024
1 parent e2c6ea1 commit 28803f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ts/file-router/src/vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ export default function vitePluginFileSystemRouter({
},
transform(code, id): Promise<TransformResult> | TransformResult {
let modifiedCode = code;
if (id.startsWith(fileURLToPath(_viewsDir)) && !basename(id).startsWith('_')) {
const viewsDirUsingSlashes = fileURLToPath(_viewsDir).replaceAll('\\', '/');
if (id.startsWith(viewsDirUsingSlashes) && !basename(id).startsWith('_')) {
if (isDevMode) {
// To enable HMR for route files with exported configurations, we need
// to address a limitation in `react-refresh`. This library requires
Expand Down

0 comments on commit 28803f0

Please # to comment.