Home / Function/ loadId() — astro Function Reference

loadId() — astro Function Reference

Architecture documentation for the loadId() function in utils.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  dac746b7_1ff2_28bd_dbdb_497c85dadc3c["loadId()"]
  17f9899e_9175_fbc8_eaf1_6cea4706bd11["utils.ts"]
  dac746b7_1ff2_28bd_dbdb_497c85dadc3c -->|defined in| 17f9899e_9175_fbc8_eaf1_6cea4706bd11
  style dac746b7_1ff2_28bd_dbdb_497c85dadc3c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/vite-plugin-astro/utils.ts lines 6–21

export async function loadId(pluginContainer: PluginContainer, id: string) {
	const result = await pluginContainer.load(id, { ssr: true });

	if (result) {
		if (typeof result === 'string') {
			return result;
		} else {
			return result.code;
		}
	}

	// Fallback to reading from fs (Vite doesn't add this by default)
	try {
		return await fs.readFile(id, 'utf-8');
	} catch {}
}

Domain

Subdomains

Frequently Asked Questions

What does loadId() do?
loadId() is a function in the astro codebase, defined in packages/astro/src/vite-plugin-astro/utils.ts.
Where is loadId() defined?
loadId() is defined in packages/astro/src/vite-plugin-astro/utils.ts at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free