Home / Function/ vitePluginApp() — astro Function Reference

vitePluginApp() — astro Function Reference

Architecture documentation for the vitePluginApp() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  1a74e6ee_a710_dc49_0dc2_993b4bf9572b["vitePluginApp()"]
  20558aee_d74c_3231_0af4_9a5df8c4d247["index.ts"]
  1a74e6ee_a710_dc49_0dc2_993b4bf9572b -->|defined in| 20558aee_d74c_3231_0af4_9a5df8c4d247
  style 1a74e6ee_a710_dc49_0dc2_993b4bf9572b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/vite-plugin-app/index.ts lines 7–52

export function vitePluginApp(): vite.Plugin[] {
	let command: vite.ResolvedConfig['command'];
	return [
		{
			name: 'astro:app',
			configResolved(config) {
				command = config.command;
			},
			resolveId: {
				filter: {
					id: new RegExp(`^${ASTRO_APP_ID}$`),
				},
				handler() {
					return RESOLVED_ASTRO_APP_ID;
				},
			},
			load: {
				filter: {
					id: new RegExp(`^${RESOLVED_ASTRO_APP_ID}$`),
				},
				handler() {
					const entrypoint =
						command === 'serve' ? 'astro/app/entrypoint/dev' : 'astro/app/entrypoint/prod';

					const code = `export { createApp } from '${entrypoint}';`;

					return {
						code,
					};
				},
			},
		},
		{
			name: 'astro:server-app',
			resolveId: {
				filter: {
					id: new RegExp(`^${ASTRO_DEV_SERVER_APP_ID}$`),
				},
				handler() {
					const url = new URL('./createAstroServerApp.js', import.meta.url);
					return this.resolve(url.toString());
				},
			},
		},
	];
}

Domain

Subdomains

Frequently Asked Questions

What does vitePluginApp() do?
vitePluginApp() is a function in the astro codebase, defined in packages/astro/src/vite-plugin-app/index.ts.
Where is vitePluginApp() defined?
vitePluginApp() is defined in packages/astro/src/vite-plugin-app/index.ts at line 7.

Analyze Your Own Codebase

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

Try Supermodel Free