Home / Function/ htmlInlineProxyPlugin() — vite Function Reference

htmlInlineProxyPlugin() — vite Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  56d5206c_a723_42ea_4f49_df56f7014fb9["htmlInlineProxyPlugin()"]
  f8fe0737_718a_5509_b722_473f207d5906["html.ts"]
  56d5206c_a723_42ea_4f49_df56f7014fb9 -->|defined in| f8fe0737_718a_5509_b722_473f207d5906
  b1b40b5b_3e43_2197_dea0_d36389d312a1["resolvePlugins()"]
  b1b40b5b_3e43_2197_dea0_d36389d312a1 -->|calls| 56d5206c_a723_42ea_4f49_df56f7014fb9
  10b9dea8_362c_1af2_93be_afa4dd9aed9e["cleanUrl()"]
  56d5206c_a723_42ea_4f49_df56f7014fb9 -->|calls| 10b9dea8_362c_1af2_93be_afa4dd9aed9e
  a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath()"]
  56d5206c_a723_42ea_4f49_df56f7014fb9 -->|calls| a4adb1a7_cf54_091f_eb63_8217e684a8e1
  51afdf58_3045_64b1_cf5b_929b1091e877["get()"]
  56d5206c_a723_42ea_4f49_df56f7014fb9 -->|calls| 51afdf58_3045_64b1_cf5b_929b1091e877
  style 56d5206c_a723_42ea_4f49_df56f7014fb9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/html.ts lines 103–137

export function htmlInlineProxyPlugin(config: ResolvedConfig): Plugin {
  // Should do this when `constructor` rather than when `buildStart`,
  // `buildStart` will be triggered multiple times then the cached result will be emptied.
  // https://github.com/vitejs/vite/issues/6372
  htmlProxyMap.set(config, new Map())
  return {
    name: 'vite:html-inline-proxy',

    resolveId: {
      filter: { id: isHtmlProxyRE },
      handler(id) {
        return id
      },
    },

    load: {
      filter: { id: isHtmlProxyRE },
      handler(id) {
        const proxyMatch = htmlProxyRE.exec(id)
        if (proxyMatch) {
          const index = Number(proxyMatch[1])
          const file = cleanUrl(id)
          const url = file.replace(normalizePath(config.root), '')
          const result = htmlProxyMap.get(config)!.get(url)?.[index]
          if (result) {
            // set moduleSideEffects to keep the module even if `treeshake.moduleSideEffects=false` is set
            return { ...result, moduleSideEffects: true }
          } else {
            throw new Error(`No matching HTML proxy module found from ${id}`)
          }
        }
      },
    },
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does htmlInlineProxyPlugin() do?
htmlInlineProxyPlugin() is a function in the vite codebase, defined in packages/vite/src/node/plugins/html.ts.
Where is htmlInlineProxyPlugin() defined?
htmlInlineProxyPlugin() is defined in packages/vite/src/node/plugins/html.ts at line 103.
What does htmlInlineProxyPlugin() call?
htmlInlineProxyPlugin() calls 3 function(s): cleanUrl, get, normalizePath.
What calls htmlInlineProxyPlugin()?
htmlInlineProxyPlugin() is called by 1 function(s): resolvePlugins.

Analyze Your Own Codebase

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

Try Supermodel Free