Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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