Skip to content

Commit

Permalink
perf: only install hmr plugin on watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 1, 2022
1 parent d9303c2 commit 09cd8f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite-node/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async function run(files: string[], options: CliOptions = {}) {
configFile: options.config,
root: options.root,
plugins: [
viteNodeHmrPlugin(),
options.watch && viteNodeHmrPlugin(),
],
})
await server.pluginContainer.buildStart({})
Expand Down Expand Up @@ -81,7 +81,7 @@ async function run(files: string[], options: CliOptions = {}) {
if (!options.watch)
await server.close()

server.emitter.on('message', (payload) => {
server.emitter?.on('message', (payload) => {
handleMessage(runner, server.emitter, files, payload)
})
}
Expand Down

0 comments on commit 09cd8f0

Please sign in to comment.