Home / Function/ getModuleInfo() — vite Function Reference

getModuleInfo() — vite Function Reference

Architecture documentation for the getModuleInfo() function in pluginContainer.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  0c657f10_5f2a_d708_4034_b4fc6ee0c7fa["getModuleInfo()"]
  285b1044_dd20_6f59_7cf5_0ad094eeacee["EnvironmentPluginContainer"]
  0c657f10_5f2a_d708_4034_b4fc6ee0c7fa -->|defined in| 285b1044_dd20_6f59_7cf5_0ad094eeacee
  4b121a62_0595_c8a4_a564_94500f5fbaf5["getModuleInfo()"]
  4b121a62_0595_c8a4_a564_94500f5fbaf5 -->|calls| 0c657f10_5f2a_d708_4034_b4fc6ee0c7fa
  87053f75_eb97_15a1_9d01_3e7bf0db1f33["getModuleInfo()"]
  87053f75_eb97_15a1_9d01_3e7bf0db1f33 -->|calls| 0c657f10_5f2a_d708_4034_b4fc6ee0c7fa
  cd131d16_e223_ab79_1b7c_8ea449ae51a2["cssPostPlugin()"]
  cd131d16_e223_ab79_1b7c_8ea449ae51a2 -->|calls| 0c657f10_5f2a_d708_4034_b4fc6ee0c7fa
  94464637_e13d_00af_69ed_f92d6e6cc584["load()"]
  94464637_e13d_00af_69ed_f92d6e6cc584 -->|calls| 0c657f10_5f2a_d708_4034_b4fc6ee0c7fa
  d1db0d45_eb52_3b21_c1e3_ccd6295c19cb["_updateModuleInfo()"]
  d1db0d45_eb52_3b21_c1e3_ccd6295c19cb -->|calls| 0c657f10_5f2a_d708_4034_b4fc6ee0c7fa
  1c3423db_563a_92c5_87fa_42d035132b6c["getModuleById()"]
  0c657f10_5f2a_d708_4034_b4fc6ee0c7fa -->|calls| 1c3423db_563a_92c5_87fa_42d035132b6c
  4b121a62_0595_c8a4_a564_94500f5fbaf5["getModuleInfo()"]
  0c657f10_5f2a_d708_4034_b4fc6ee0c7fa -->|calls| 4b121a62_0595_c8a4_a564_94500f5fbaf5
  style 0c657f10_5f2a_d708_4034_b4fc6ee0c7fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/pluginContainer.ts lines 236–263

  getModuleInfo(id: string): ModuleInfo | null {
    const module = this.moduleGraph?.getModuleById(id)
    if (!module) {
      return null
    }
    if (!module.info) {
      module.info = new Proxy(
        { id, meta: module.meta || EMPTY_OBJECT } as ModuleInfo,
        // throw when an unsupported ModuleInfo property is accessed,
        // so that incompatible plugins fail in a non-cryptic way.
        {
          get(info: any, key: string) {
            if (key in info) {
              return info[key]
            }
            // Don't throw an error when returning from an async function
            if (key === 'then') {
              return undefined
            }
            throw Error(
              `[vite] The "${key}" property of ModuleInfo is not supported.`,
            )
          },
        },
      )
    }
    return module.info ?? null
  }

Domain

Subdomains

Frequently Asked Questions

What does getModuleInfo() do?
getModuleInfo() is a function in the vite codebase, defined in packages/vite/src/node/server/pluginContainer.ts.
Where is getModuleInfo() defined?
getModuleInfo() is defined in packages/vite/src/node/server/pluginContainer.ts at line 236.
What does getModuleInfo() call?
getModuleInfo() calls 2 function(s): getModuleById, getModuleInfo.
What calls getModuleInfo()?
getModuleInfo() is called by 5 function(s): _updateModuleInfo, cssPostPlugin, getModuleInfo, getModuleInfo, load.

Analyze Your Own Codebase

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

Try Supermodel Free