Your portfolio has been successfully migrated from Create React App to Vite!
- β
Created
vite.config.jswith React plugin and esbuild configuration for JSX in .js files - β
Moved
public/index.htmlto root directory - β
Updated
index.htmlto remove%PUBLIC_URL%references and add Vite script tag
- β
Removed
react-scriptsand testing libraries - β
Added Vite and
@vitejs/plugin-react - β Upgraded React from v17 to v18
- β Upgraded React Router from v5 to v6
- β
Updated scripts:
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run deploy- Deploy to GitHub Pages (dist folder)
- β
Added
"type": "module"for ES modules support
- β
Updated
src/index.jsto use React 18'screateRootAPI - β
Updated
src/App.jsfor React Router v6 (Routes instead of Switch, element instead of component) - β
Updated
src/utils/ScrollToTop.jsto useuseLocationhook instead ofwithRouter - β
Changed environment variables from
process.env.REACT_APP_*toimport.meta.env.VITE_* - β
Updated
.env.samplewith new VITE_ prefix
- β
Updated
.gitignoreto include/distand.vitefolders
# Start development server (http://localhost:3000)
npm run dev
# Build for production
npm run build
# Preview production build locally
npm run preview
# Deploy to GitHub Pages
npm run deploy- Old format:
process.env.REACT_APP_SERVICE_ID - New format:
import.meta.env.VITE_SERVICE_ID
If you have a .env file, update all variables:
REACT_APP_SERVICE_IDβVITE_SERVICE_IDREACT_APP_TEMPLATE_IDβVITE_TEMPLATE_IDREACT_APP_USER_IDβVITE_USER_ID
The base in vite.config.js is currently set to / for root deployment. If you need to deploy to a subdirectory (like /krishkash.github.io/), update it in vite.config.js:
base: '/krishkash.github.io/',- Old:
build/folder - New:
dist/folder
Make sure your GitHub Pages deployment is configured to use the dist folder.
Vite offers several advantages over Create React App:
- β‘ Faster startup: Development server starts almost instantly
- π₯ Hot Module Replacement (HMR): Updates reflect immediately without full page reload
- π¦ Optimized builds: Faster production builds with Rollup
- π― Better dev experience: Instant feedback during development
- β Development server is running successfully
- Test all features of your portfolio
- If you have environment variables, create a
.envfile with VITE_ prefixes - Run
npm run buildto test production build - Update GitHub Actions workflow if you have CI/CD (change from
build/todist/)
If you encounter any issues:
- Clear cache:
rm -rf node_modules .vite distandnpm install --legacy-peer-deps - Check console: Open browser dev tools to see any runtime errors
- Environment variables: Ensure they're prefixed with
VITE_and the.envfile is in the root directory