Home / Function/ removeStyle() — vite Function Reference

removeStyle() — vite Function Reference

Architecture documentation for the removeStyle() function in client.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  248350b7_1dd6_f06d_db34_ecb0eba3a0b0["removeStyle()"]
  85908ff5_4d12_826d_8235_531f91538758["client.ts"]
  248350b7_1dd6_f06d_db34_ecb0eba3a0b0 -->|defined in| 85908ff5_4d12_826d_8235_531f91538758
  style 248350b7_1dd6_f06d_db34_ecb0eba3a0b0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/client/client.ts lines 579–598

export function removeStyle(id: string): void {
  if (linkSheetsMap.has(id)) {
    // re-select elements since HMR can replace links
    document
      .querySelectorAll<HTMLLinkElement>(
        `link[rel="stylesheet"][data-vite-dev-id]`,
      )
      .forEach((el) => {
        if (el.getAttribute('data-vite-dev-id') === id) {
          el.remove()
        }
      })
    linkSheetsMap.delete(id)
  }
  const style = sheetsMap.get(id)
  if (style) {
    document.head.removeChild(style)
    sheetsMap.delete(id)
  }
}

Domain

Subdomains

Frequently Asked Questions

What does removeStyle() do?
removeStyle() is a function in the vite codebase, defined in packages/vite/src/client/client.ts.
Where is removeStyle() defined?
removeStyle() is defined in packages/vite/src/client/client.ts at line 579.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free