Skip to content

Commit

Permalink
fix: hot reload not working on windows (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
geowarin authored Jan 18, 2024
1 parent 5afd609 commit f3d7f62
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/router-vite-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Plugin } from 'vite'
import { join } from 'path'
import { join, normalize } from 'path'
import { readFile } from 'fs/promises'
import {
type Config,
Expand Down Expand Up @@ -49,11 +49,12 @@ export function TanStackRouterVite(inlineConfig: UserConfig = {}): Plugin {
await generate()
},
handleHotUpdate: async ({ file }) => {
if (file === join(ROOT, CONFIG_FILE_NAME)) {
const filePath = normalize(file)
if (filePath === join(ROOT, CONFIG_FILE_NAME)) {
userConfig = await buildConfig(inlineConfig, ROOT)
return
}
if (file.startsWith(join(ROOT, userConfig.routesDirectory))) {
if (filePath.startsWith(join(ROOT, userConfig.routesDirectory))) {
await generate()
}
},
Expand Down

0 comments on commit f3d7f62

Please sign in to comment.