Skip to content

Commit

Permalink
fix: use environment config root for hmr filename
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarv committed Jun 4, 2024
1 parent bbca0b4 commit a5e6c97
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/vite/src/node/server/hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export async function handleHMRUpdate(

// (dev only) the client itself cannot be hot updated.
if (file.startsWith(withTrailingSlash(normalizedClientDir))) {
environments.forEach(({ hot }) =>
environments.forEach(({ config, hot }) =>
hot.send({
type: 'full-reload',
path: '*',
Expand Down Expand Up @@ -370,9 +370,10 @@ export async function handleHMRUpdate(
)
environment.hot.send({
type: 'full-reload',
path: config.server.middlewareMode
path: environment.config.server.middlewareMode
? '*'
: '/' + normalizePath(path.relative(config.root, file)),
: '/' +
normalizePath(path.relative(environment.config.root, file)),
})
} else {
// loaded but not in the module graph, probably not js
Expand All @@ -383,7 +384,7 @@ export async function handleHMRUpdate(
return
}

updateModules(environment, shortFile, context.modules, timestamp)
updateModules(environment, file, context.modules, timestamp)
} catch (err) {
environment.hot.send({
type: 'error',
Expand Down

0 comments on commit a5e6c97

Please sign in to comment.