Overview
The VENCOL Front Template is built with Vite and can be deployed to any static hosting platform. This guide focuses on Vercel and Netlify, the two most popular options.Project Configuration
Your project includes build configuration inpackage.json:
Deploying to Vercel
Vercel is the recommended platform for deploying Vite applications. The project includesvercel.json configuration.
Vercel Configuration
Deploy via Vercel CLI
Install Vercel CLI
Login to Vercel
Deploy
Deploy to production
Deploy via Vercel Dashboard
Push to Git
Import to Vercel
Configure build settings
- Framework Preset: Vite
- Build Command:
vite build - Output Directory:
dist - Install Command:
npm install
Add environment variables
Deploy
Deploying to Netlify
Netlify is another excellent option for deploying static sites.Netlify Configuration
Createnetlify.toml in your project root:
Deploy via Netlify CLI
Install Netlify CLI
Login to Netlify
Initialize your site
Deploy
Deploy via Netlify Dashboard
Push to Git
Import to Netlify
Configure build settings
- Build command:
npm run build - Publish directory:
dist - Base directory: (leave empty)
Add environment variables
Deploy
Building Locally
Test your production build locally before deploying:dist directory.
Environment Variables
Vite uses environment variables prefixed withVITE_.
Local Development
Create.env in your project root:
Production Variables
Accessing Environment Variables
In your code:Custom Domain Setup
Vercel Custom Domain
Open project settings
Add domain
www.vencol.com)Configure DNS
Wait for DNS propagation
Netlify Custom Domain
Open domain settings
Add domain
Configure DNS
Enable HTTPS
Performance Optimization
1. Enable Build Caching
Both Vercel and Netlify cachenode_modules automatically.
2. Image Optimization
3. Code Splitting
Vite automatically splits code by routes. To optimize further:4. Bundle Analysis
Analyze your bundle size:vite.config.ts:
npm run build to generate a bundle analysis.
Continuous Deployment
Both Vercel and Netlify support automatic deployments:Git Workflow
Push to branch
Preview deployment created
Merge to main
Production deployment
Monitoring & Analytics
Vercel Analytics
Enable analytics in your Vercel dashboard:- Project Settings → Analytics
- Enable Web Analytics
- No code changes required
Google Analytics
Add Google Analytics toindex.html:
Troubleshooting
Build Fails on Deployment
- Check build logs in your hosting platform dashboard
- Test locally: Run
npm run buildto replicate the error - Check Node version: Ensure your hosting platform uses Node 18+
- Clear cache: Force a clean build without cache
Routes Return 404
Problem: Direct navigation to/nosotros returns 404
Solution: Ensure your vercel.json or netlify.toml includes SPA redirects
Environment Variables Not Working
- Check prefix: Must start with
VITE_ - Rebuild: Environment variables require a new build
- Check scope: Ensure variables are set for production environment
Images Not Loading
- Check CORS: Ensure image CDN allows your domain
- Check URLs: Use absolute URLs, not relative paths
- Check HTTPS: Mixed content (HTTP images on HTTPS site) may be blocked
Deployment Checklist
Update site metadata
siteUrl in data/data.tsx with your production domainConfigure WordPress URL
VITE_WORDPRESS_API_URL environment variableTest production build
npm run build && npm run preview locallyCheck responsive design
Verify all routes work
Set up custom domain
Enable analytics
Test contact form
Next Steps
After deployment:- Monitor performance with Lighthouse
- Set up uptime monitoring (e.g., UptimeRobot)
- Configure Google Search Console
- Submit sitemap to search engines
- Set up email notifications for build failures