| 584 | } |
| 585 | |
| 586 | export function removeStyle(id: string): void { |
| 587 | if (linkSheetsMap.has(id)) { |
| 588 | // re-select elements since HMR can replace links |
| 589 | document |
| 590 | .querySelectorAll<HTMLLinkElement>( |
| 591 | `link[rel="stylesheet"][data-vite-dev-id="${CSS.escape(id)}"]`, |
| 592 | ) |
| 593 | .forEach((el) => el.remove()) |
| 594 | linkSheetsMap.delete(id) |
| 595 | } |
| 596 | const style = sheetsMap.get(id) |
| 597 | if (style) { |
| 598 | document.head.removeChild(style) |
| 599 | sheetsMap.delete(id) |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | export function createHotContext(ownerPath: string): ViteHotContext { |
| 604 | return new HMRContext(hmrClient, ownerPath) |