React Application Deployment Checklist
Deploying a React application to production involves more than npm run build. Use this checklist to ship confidently.
Build Optimization
# Production build
NODE_ENV=production npm run build
# Analyze bundle size
npx source-map-explorer 'build/static/js/*.js'- [ ] Production build with minification and tree-shaking
- [ ] Bundle size analyzed — no oversized dependencies
- [ ] Code splitting configured for routes
- [ ] Images optimized and served in modern formats (WebP/AVIF)
Environment Variables
# .env.production
REACT_APP_API_URL=https://api.example.com
REACT_APP_VERSION=$npm_package_version- [ ] All
REACT_APP_*variables set for production - [ ] No secrets in client-side environment variables
- [ ] API URLs point to production endpoints
Security
- [ ] Content Security Policy headers configured
- [ ]
X-Frame-Options: DENYto prevent clickjacking - [ ] Subresource Integrity for CDN assets
- [ ] No
console.logstatements in production - [ ] Source maps uploaded to error tracker (not public)
Performance
- [ ] Lazy loading for below-the-fold components
- [ ] Service worker configured (or explicitly disabled)
- [ ] Critical CSS inlined
- [ ] Preconnect hints for external domains
<link rel="preconnect" href="https://api.example.com" />
<link rel="dns-prefetch" href="https://api.example.com" />CDN & Caching
- [ ] Static assets served from CDN
- [ ] Cache-Control headers:
max-age=31536000for hashed assets - [ ]
index.htmlserved withno-cache - [ ] Gzip/Brotli compression enabled
Error Tracking
import * as Bugsly from '@bugsly/react';
Bugsly.init({ dsn: 'your-dsn' });
// Wrap your app with error boundary
<Bugsly.ErrorBoundary fallback={<ErrorFallback />}>
<App />
</Bugsly.ErrorBoundary>- [ ] Error tracking initialized before app renders
- [ ] Source maps uploaded for readable stack traces
- [ ] Error boundary wrapping top-level app component
Hosting
- [ ] SPA fallback configured (all routes serve
index.html) - [ ] HTTPS enforced
- [ ] Custom 404 page configured
- [ ] Redirect from www to non-www (or vice versa)
Try Bugsly Free
AI-powered error tracking that explains your bugs. Set up in 2 minutes, free forever for small projects.
Get Started FreeRelated Articles
Fix Infinite Loop in Flutter
Resolve infinite loop issues in Flutter apps caused by setState in build methods, recursive widget rebuilds, and stream listener loops.
Read moreHow to Fix Referenceerror in Deno
Learn how to diagnose and fix the referenceerror in Deno. Includes code examples and prevention tips.
Read moreHow to Fix Permissionerror in Deno
Learn how to diagnose and fix the permissionerror in Deno. Includes code examples and prevention tips.
Read moreHow to Fix Permissionerror in Java
Learn how to diagnose and fix the permissionerror in Java. Includes code examples and prevention tips.
Read more