Home / Function/ vitePluginStaticPaths() — astro Function Reference

vitePluginStaticPaths() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2b6e9b05_b9e6_e14b_a6ff_e155b09289e3["vitePluginStaticPaths()"]
  d68e5306_c538_f1dd_7811_2ac2f7f8b490["index.ts"]
  2b6e9b05_b9e6_e14b_a6ff_e155b09289e3 -->|defined in| d68e5306_c538_f1dd_7811_2ac2f7f8b490
  style 2b6e9b05_b9e6_e14b_a6ff_e155b09289e3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/vite-plugin-static-paths/index.ts lines 14–47

export default function vitePluginStaticPaths(): Plugin {
	return {
		name: 'astro:static-paths',
		enforce: 'pre',

		resolveId: {
			filter: {
				id: new RegExp(`^${ASTRO_STATIC_PATHS_MODULE_ID}$`),
			},
			handler() {
				return ASTRO_STATIC_PATHS_RESOLVED_ID;
			},
		},

		load: {
			filter: {
				id: new RegExp(`^${ASTRO_STATIC_PATHS_RESOLVED_ID}$`),
			},
			handler() {
				// Only provide real implementation in prerender environment
				if (this.environment?.name !== ASTRO_VITE_ENVIRONMENT_NAMES.prerender) {
					return {
						code: `export class StaticPaths { async getAll() { return []; } }`,
					};
				}

				// Re-export StaticPaths class from runtime module
				return {
					code: `export { StaticPaths } from 'astro/runtime/prerender/static-paths.js';`,
				};
			},
		},
	};
}

Domain

Subdomains

Frequently Asked Questions

What does vitePluginStaticPaths() do?
vitePluginStaticPaths() is a function in the astro codebase, defined in packages/astro/src/vite-plugin-static-paths/index.ts.
Where is vitePluginStaticPaths() defined?
vitePluginStaticPaths() is defined in packages/astro/src/vite-plugin-static-paths/index.ts at line 14.

Analyze Your Own Codebase

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

Try Supermodel Free