Home / Function/ dev() — astro Function Reference

dev() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e109f69d_ab11_35fd_f1e8_ecb636d49171["dev()"]
  4ecbc5f0_c710_d782_6339_7a45fc4af496["index.ts"]
  e109f69d_ab11_35fd_f1e8_ecb636d49171 -->|defined in| 4ecbc5f0_c710_d782_6339_7a45fc4af496
  style e109f69d_ab11_35fd_f1e8_ecb636d49171 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/cli/dev/index.ts lines 10–40

export async function dev({ flags }: DevOptions) {
	if (flags.help || flags.h) {
		printHelp({
			commandName: 'astro dev',
			usage: '[...flags]',
			tables: {
				Flags: [
					['--mode', `Specify the mode of the project. Defaults to "development".`],
					['--port', `Specify which port to run on. Defaults to 4321.`],
					['--host', `Listen on all addresses, including LAN and public addresses.`],
					['--host <custom-address>', `Expose on a network IP address at <custom-address>`],
					['--open', 'Automatically open the app in the browser on server start'],
					['--force', 'Clear the content layer cache, forcing a full rebuild.'],
					[
						'--allowed-hosts',
						'Specify a comma-separated list of allowed hosts or allow any hostname.',
					],
					['--help (-h)', 'See all available flags.'],
				],
			},
			description: `Check ${colors.cyan(
				'https://docs.astro.build/en/reference/cli-reference/#astro-dev',
			)} for more information.`,
		});
		return;
	}

	const inlineConfig = flagsToAstroInlineConfig(flags);

	return await devServer(inlineConfig);
}

Domain

Subdomains

Frequently Asked Questions

What does dev() do?
dev() is a function in the astro codebase, defined in packages/astro/src/cli/dev/index.ts.
Where is dev() defined?
dev() is defined in packages/astro/src/cli/dev/index.ts at line 10.

Analyze Your Own Codebase

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

Try Supermodel Free