MCPcopy
hub / github.com/vitejs/vite / hotUpdate

Function hotUpdate

playground/hmr-ssr/vite.config.ts:18–25  ·  view source on GitHub ↗
({ file, read, server })

Source from the content-addressed store, hash-verified

16 {
17 name: 'mock-custom',
18 async hotUpdate({ file, read, server }) {
19 if (file.endsWith('customFile.js')) {
20 const content = await read()
21 const msg = content.match(/export const msg = '(\w+)'/)[1]
22 this.environment.hot.send('custom:foo', { msg })
23 this.environment.hot.send('custom:remove', { msg })
24 }
25 },
26 configureServer(server) {
27 server.environments.ssr.hot.on(
28 'custom:remote-add',

Callers

nothing calls this directly

Calls 2

sendMethod · 0.65
readFunction · 0.50

Tested by

no test coverage detected