Home / Function/ postImportMapHook() — vite Function Reference

postImportMapHook() — vite Function Reference

Architecture documentation for the postImportMapHook() function in html.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  6c4a81f2_0b84_113e_b706_96c3d99e6151["postImportMapHook()"]
  f8fe0737_718a_5509_b722_473f207d5906["html.ts"]
  6c4a81f2_0b84_113e_b706_96c3d99e6151 -->|defined in| f8fe0737_718a_5509_b722_473f207d5906
  39f26be8_b1d9_a756_3043_474687a6bbb7["buildHtmlPlugin()"]
  39f26be8_b1d9_a756_3043_474687a6bbb7 -->|calls| 6c4a81f2_0b84_113e_b706_96c3d99e6151
  7a53712a_b13b_4bc2_85fc_b4de5cb705fb["createDevHtmlTransformFn()"]
  7a53712a_b13b_4bc2_85fc_b4de5cb705fb -->|calls| 6c4a81f2_0b84_113e_b706_96c3d99e6151
  style 6c4a81f2_0b84_113e_b706_96c3d99e6151 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/html.ts lines 1167–1186

export function postImportMapHook(): IndexHtmlTransformHook {
  return (html) => {
    if (!importMapAppendRE.test(html)) return

    let importMap: string | undefined
    html = html.replace(importMapRE, (match) => {
      importMap = match
      return ''
    })

    if (importMap) {
      html = html.replace(
        importMapAppendRE,
        (match) => `${importMap}\n${match}`,
      )
    }

    return html
  }
}

Domain

Subdomains

Frequently Asked Questions

What does postImportMapHook() do?
postImportMapHook() is a function in the vite codebase, defined in packages/vite/src/node/plugins/html.ts.
Where is postImportMapHook() defined?
postImportMapHook() is defined in packages/vite/src/node/plugins/html.ts at line 1167.
What calls postImportMapHook()?
postImportMapHook() is called by 2 function(s): buildHtmlPlugin, createDevHtmlTransformFn.

Analyze Your Own Codebase

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

Try Supermodel Free