Build Process
Run the production build
Build the site for production:This command:
- Compiles TypeScript and Astro components
- Processes Tailwind CSS and optimizes styles
- Bundles React components with Vite
- Generates static HTML pages
- Optimizes assets and images
Preview the build locally
Test the production build before deploying:The built site will be served at
http://localhost:4321Use
npm run preview:host to test on other devices on your local network.Build Configuration
The Astro configuration includes essential settings for deployment:astro.config.mjs
Key Configuration Options
- site: The production URL of your site (required for sitemap generation)
- integrations:
@astrojs/react- Enables React component support@astrojs/sitemap- Auto-generatessitemap.xmlfor SEO
- vite.plugins: Tailwind CSS v4 integration via Vite
Deployment Platforms
Vercel (Recommended)
Chitagá Tech is configured for Vercel deployment:Connect your repository
- Go to vercel.com
- Click “New Project”
- Import your Git repository
Configure build settings
Vercel auto-detects Astro projects. Verify these settings:
- Framework Preset: Astro
- Build Command:
npm run build - Output Directory:
dist - Install Command:
npm install
Netlify
Deploy to Netlify with these settings:netlify.toml
Cloudflare Pages
Deploy to Cloudflare Pages:Build configuration
Set these build settings:
- Build command:
npm run build - Build output directory:
dist - Node version: 18 or later
GitHub Pages
For GitHub Pages deployment, add a workflow file:.github/workflows/deploy.yml
astro.config.mjs for GitHub Pages:
Sitemap Generation
The@astrojs/sitemap integration automatically generates a sitemap at build time:
- Output:
dist/sitemap-index.xmlanddist/sitemap-0.xml - Includes: All static pages and routes
- Updates: Automatically on each build
The sitemap uses the
site URL from astro.config.mjs. Make sure it matches your production domain.Performance Optimization
Astro automatically optimizes your build:- HTML minification - Reduces file size
- CSS optimization - Removes unused styles, minifies output
- JavaScript bundling - Combines and minimizes JS files
- Asset optimization - Compresses images and static files
- Zero JS by default - Astro pages ship with no JavaScript unless needed
Build Output
Typical build produces:Environment Variables
For environment-specific configuration:Variables prefixed with
PUBLIC_ are exposed to client-side code. Never use this prefix for sensitive data.Troubleshooting
Build fails with TypeScript errors
Check yourtsconfig.json extends the correct Astro config:
Styles not applying correctly
Ensure Tailwind is properly configured in Vite plugins:astro.config.mjs
Missing sitemap
Verify thesite URL is set in astro.config.mjs:
Next Steps
- Review development setup
- Learn about styling
- Explore Astro deployment docs