Skip to content

Commit

Permalink
fix(hmr): package.json change should trigger server restart (#15519)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea authored Jan 8, 2024
1 parent f8c6a34 commit 260ebbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/node/server/hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ export async function handleHMRUpdate(
const isConfigDependency = config.configFileDependencies.some(
(name) => file === name,
)
const isPackageJson = fileName === 'package.json'

const isEnv =
config.inlineConfig.envFile !== false &&
getEnvFilesForMode(config.mode).includes(fileName)
if (isConfig || isConfigDependency || isEnv) {
if (isConfig || isConfigDependency || isPackageJson || isEnv) {
// auto restart server
debugHmr?.(`[config change] ${colors.dim(shortFile)}`)
config.logger.info(
Expand Down

0 comments on commit 260ebbf

Please sign in to comment.