Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use environment config root for hmr filename #17394

Closed
wants to merge 1 commit into from
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
Loading