Home / Function/ getComponentByRoute() — astro Function Reference

getComponentByRoute() — astro Function Reference

Architecture documentation for the getComponentByRoute() function in pipeline.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  e63fd70c_59a1_5108_dff0_9a497e524393["getComponentByRoute()"]
  1856d10d_49b6_d49e_0f37_cbee2beb3083["NonRunnablePipeline"]
  e63fd70c_59a1_5108_dff0_9a497e524393 -->|defined in| 1856d10d_49b6_d49e_0f37_cbee2beb3083
  3a71f207_88eb_a31f_8d09_b750c013e060["tryRewrite()"]
  3a71f207_88eb_a31f_8d09_b750c013e060 -->|calls| e63fd70c_59a1_5108_dff0_9a497e524393
  style e63fd70c_59a1_5108_dff0_9a497e524393 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/app/dev/pipeline.ts lines 127–138

	async getComponentByRoute(routeData: RouteData): Promise<ComponentInstance> {
		try {
			const module = await this.getModuleForRoute(routeData);
			return module.page();
		} catch {
			// could not find, ignore
		}

		const url = new URL(routeData.component, this.manifest.rootDir);
		const module = await import(/* @vite-ignore */ url.toString());
		return module;
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getComponentByRoute() do?
getComponentByRoute() is a function in the astro codebase, defined in packages/astro/src/core/app/dev/pipeline.ts.
Where is getComponentByRoute() defined?
getComponentByRoute() is defined in packages/astro/src/core/app/dev/pipeline.ts at line 127.
What calls getComponentByRoute()?
getComponentByRoute() is called by 1 function(s): tryRewrite.

Analyze Your Own Codebase

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

Try Supermodel Free