Skip to content

Commit

Permalink
feat: trigger beforeFullReload / beforePrune / invalidate hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ycmjason committed Nov 1, 2022
1 parent 7f55c54 commit 772e778
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/vite-node/src/hmr/hmr.ts
Expand Up @@ -195,9 +195,11 @@ export async function handleMessage(runner: ViteNodeRunner, emitter: HMREmitter,
})
break
case 'full-reload':
notifyListeners(runner, 'vite:beforeFullReload', payload)
reload(runner, files)
break
case 'prune':
notifyListeners(runner, 'vite:beforePrune', payload)
payload.paths.forEach((path) => {
const fn = maps.pruneMap.get(path)
if (fn)
Expand Down Expand Up @@ -277,6 +279,7 @@ export function createHotContext(
},

invalidate() {
notifyListeners(runner, 'vite:invalidate', { path: ownerPath })
return reload(runner, files)
},

Expand Down

0 comments on commit 772e778

Please sign in to comment.