This guide covers deploying your React + TypeScript frontend application to production.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Mich9025/vencol-front/llms.txt
Use this file to discover all available pages before exploring further.
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:
package.json
Deploying to Vercel
Vercel is the recommended platform for deploying Vite applications. The project includesvercel.json configuration.
Vercel Configuration
vercel.json
Deploy via Vercel CLI
Deploy via Vercel Dashboard
Import to Vercel
Go to vercel.com/new and import your repository
Configure build settings
- Framework Preset: Vite
- Build Command:
vite build - Output Directory:
dist - Install Command:
npm install
Vercel will automatically deploy new commits from your main branch. Preview deployments are created for pull requests.
Deploying to Netlify
Netlify is another excellent option for deploying static sites.Netlify Configuration
Createnetlify.toml in your project root:
netlify.toml
Deploy via Netlify CLI
Deploy via Netlify Dashboard
Import to Netlify
Go to app.netlify.com and click “Add new site”
Configure build settings
- Build command:
npm run build - Publish directory:
dist - Base directory: (leave empty)
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:
.env
Production Variables
Accessing Environment Variables
In your code:Custom Domain Setup
Vercel Custom Domain
Configure DNS
Add the following DNS records at your domain registrar:Option A: Using A recordOption B: Using CNAME
Netlify Custom Domain
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:App.tsx
4. Bundle Analysis
Analyze your bundle size:vite.config.ts:
vite.config.ts
npm run build to generate a bundle analysis.
Continuous Deployment
Both Vercel and Netlify support automatic deployments:Git Workflow
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:
index.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
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