Skip to content

Commit

Permalink
fix: Make file route HMR work on Windows (#2978)
Browse files Browse the repository at this point in the history
Fixes #2964
  • Loading branch information
Artur- authored and vaadin-bot committed Dec 10, 2024
1 parent a8ea79f commit 1a77814
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 @@ -112,7 +112,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 1a77814

Please # to comment.