load() — vite Function Reference
Architecture documentation for the load() function in pluginContainer.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 94464637_e13d_00af_69ed_f92d6e6cc584["load()"] c261dae5_9c68_4b7d_8b09_fe13190425fe["PluginContext"] 94464637_e13d_00af_69ed_f92d6e6cc584 -->|defined in| c261dae5_9c68_4b7d_8b09_fe13190425fe d1db0d45_eb52_3b21_c1e3_ccd6295c19cb["_updateModuleInfo()"] 94464637_e13d_00af_69ed_f92d6e6cc584 -->|calls| d1db0d45_eb52_3b21_c1e3_ccd6295c19cb 4b121a62_0595_c8a4_a564_94500f5fbaf5["getModuleInfo()"] 94464637_e13d_00af_69ed_f92d6e6cc584 -->|calls| 4b121a62_0595_c8a4_a564_94500f5fbaf5 77ccd6ac_9a63_b9a5_0b1b_b3bd2ee25604["ensureEntryFromUrl()"] 94464637_e13d_00af_69ed_f92d6e6cc584 -->|calls| 77ccd6ac_9a63_b9a5_0b1b_b3bd2ee25604 795dec35_22f9_80f5_ccab_9c2d170af0d3["unwrapId()"] 94464637_e13d_00af_69ed_f92d6e6cc584 -->|calls| 795dec35_22f9_80f5_ccab_9c2d170af0d3 bff62ce1_58a6_b7b5_ef28_a3e2a2bc0779["load()"] 94464637_e13d_00af_69ed_f92d6e6cc584 -->|calls| bff62ce1_58a6_b7b5_ef28_a3e2a2bc0779 dcf6f9d5_316b_0287_6984_8729d3e6c0aa["transform()"] 94464637_e13d_00af_69ed_f92d6e6cc584 -->|calls| dcf6f9d5_316b_0287_6984_8729d3e6c0aa 0c657f10_5f2a_d708_4034_b4fc6ee0c7fa["getModuleInfo()"] 94464637_e13d_00af_69ed_f92d6e6cc584 -->|calls| 0c657f10_5f2a_d708_4034_b4fc6ee0c7fa style 94464637_e13d_00af_69ed_f92d6e6cc584 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/server/pluginContainer.ts lines 816–840
async load(
options: {
id: string
resolveDependencies?: boolean
} & Partial<PartialNull<ModuleOptions>>,
): Promise<ModuleInfo> {
// We may not have added this to our module graph yet, so ensure it exists
await this._container.moduleGraph?.ensureEntryFromUrl(unwrapId(options.id))
// Not all options passed to this function make sense in the context of loading individual files,
// but we can at least update the module info properties we support
this._updateModuleInfo(options.id, options)
const loadResult = await this._container.load(options.id)
const code = typeof loadResult === 'object' ? loadResult?.code : loadResult
if (code != null) {
await this._container.transform(code, options.id)
}
const moduleInfo = this.getModuleInfo(options.id)
// This shouldn't happen due to calling ensureEntryFromUrl, but 1) our types can't ensure that
// and 2) moduleGraph may not have been provided (though in the situations where that happens,
// we should never have plugins calling this.load)
if (!moduleInfo) throw Error(`Failed to load module with id ${options.id}`)
return moduleInfo
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does load() do?
load() is a function in the vite codebase, defined in packages/vite/src/node/server/pluginContainer.ts.
Where is load() defined?
load() is defined in packages/vite/src/node/server/pluginContainer.ts at line 816.
What does load() call?
load() calls 7 function(s): _updateModuleInfo, ensureEntryFromUrl, getModuleInfo, getModuleInfo, load, transform, unwrapId.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free