Skip to content

Commit

Permalink
feat(vite-node): trigger beforeFullReload / beforePrune / invalidate …
Browse files Browse the repository at this point in the history
…hook (#2079)
  • Loading branch information
ycmjason authored Nov 1, 2022
1 parent 7f55c54 commit b574a94
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/vite-node/src/hmr/hmr.ts
Original file line number Diff line number Diff line change
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 b574a94

Please sign in to comment.