Skip to content

Commit

Permalink
fix(hmr): watch file changes even when HMR is disabled (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreBonaventure committed Jan 12, 2021
1 parent 730d2f0 commit cc5fa6e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/vite/src/node/server/index.ts
Expand Up @@ -243,11 +243,11 @@ export async function createServer(
}
}

if (serverConfig.hmr !== false) {
watcher.on('change', async (file) => {
file = normalizePath(file)
// invalidate module graph cache on file change
moduleGraph.onFileChange(file)
watcher.on('change', async (file) => {
file = normalizePath(file)
// invalidate module graph cache on file change
moduleGraph.onFileChange(file)
if (serverConfig.hmr !== false) {
try {
await handleHMRUpdate(file, server)
} catch (err) {
Expand All @@ -256,8 +256,8 @@ export async function createServer(
err: prepareError(err)
})
}
})
}
}
})

// apply server configuration hooks from plugins
const postHooks: ((() => void) | void)[] = []
Expand Down

0 comments on commit cc5fa6e

Please sign in to comment.