Build Command
The build process is triggered using:astro build as defined in package.json:7.
Build Configuration
The build behavior is configured inastro.config.mjs:1:
Key Settings
output: 'static'- Generates static HTML files for all pages at build timecompressHTML: true- Minifies HTML output to reduce file sizevite.ssr.noExternal: ['gsap']- Ensures GSAP animation library is processed during server-side rendering
Build Output
The build process generates adist/ folder containing:
- Static HTML files - Pre-rendered pages for all routes
- Optimized assets - Minified CSS and JavaScript bundles
- Public files - Static assets from
public/directory, including:/api/proxy.php- PHP proxy for eGO API integration- Images and fonts
- Favicon and other static resources
Output Structure
Environment Variables
The build requires the eGO Real Estate API token:.env file. In production (GitHub Actions), it’s injected as a secret.
Asset Optimization
Astro automatically optimizes assets during the build:- JavaScript - Bundled and minified with content-based hashing
- CSS - Extracted, minified, and scoped to components
- Images - Copied from
public/without transformation (optimization happens at source) - HTML - Compressed and whitespace-removed when
compressHTML: true
Build Validation
The deployment workflow includes an automated validation step to ensure properties are present:Build Troubleshooting
Properties Not Loading
Symptom: Build validation fails with “NO se encontraron propiedades” Causes:- Invalid or expired
PUBLIC_EGO_API_TOKEN - eGO API rate limiting (HTTP 429)
- Network connectivity issues during build
Build Memory Issues
Symptom: Build process crashes or hangs Solution:GSAP SSR Errors
Symptom: “Cannot use import statement outside a module” for GSAP Solution: Thevite.ssr.noExternal: ['gsap'] configuration in astro.config.mjs:12 handles this. Ensure it’s present.
Slow Build Times
Typical build time: 30-60 seconds (depending on number of properties) Factors affecting build speed:- Number of API requests to eGO
- Network latency
- Server resources (GitHub Actions uses ubuntu-latest runners)
Local Build Testing
Before deploying, test the build locally:dist/ folder at http://localhost:4321 to verify the production build.