({ file, read, server })
| 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', |