preview() — astro Function Reference
Architecture documentation for the preview() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 9b0ff3b2_3e0c_4b6d_8b60_20e3c046b818["preview()"] 5a655f72_26c4_fb42_ed4d_5dc8a24063cc["index.ts"] 9b0ff3b2_3e0c_4b6d_8b60_20e3c046b818 -->|defined in| 5a655f72_26c4_fb42_ed4d_5dc8a24063cc style 9b0ff3b2_3e0c_4b6d_8b60_20e3c046b818 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/cli/preview/index.ts lines 10–38
export async function preview({ flags }: PreviewOptions) {
if (flags?.help || flags?.h) {
printHelp({
commandName: 'astro preview',
usage: '[...flags]',
tables: {
Flags: [
['--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'],
[
'--allowed-hosts',
'Specify a comma-separated list of allowed hosts or allow any hostname.',
],
['--help (-h)', 'See all available flags.'],
],
},
description: `Starts a local server to serve your static dist/ directory. Check ${colors.cyan(
'https://docs.astro.build/en/reference/cli-reference/#astro-preview',
)} for more information.`,
});
return;
}
const inlineConfig = flagsToAstroInlineConfig(flags);
return await previewServer(inlineConfig);
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does preview() do?
preview() is a function in the astro codebase, defined in packages/astro/src/cli/preview/index.ts.
Where is preview() defined?
preview() is defined in packages/astro/src/cli/preview/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