({ file, read })
| 37 | { |
| 38 | name: 'mock-custom', |
| 39 | async hotUpdate({ file, read }) { |
| 40 | if (file.endsWith('customFile.js')) { |
| 41 | const content = await read() |
| 42 | const msg = content.match(/export const msg = '(\w+)'/)[1] |
| 43 | this.environment.hot.send('custom:foo', { msg }) |
| 44 | this.environment.hot.send('custom:remove', { msg }) |
| 45 | } |
| 46 | }, |
| 47 | configureServer(server) { |
| 48 | server.environments.client.hot.on( |
| 49 | 'custom:remote-add', |