Create React App → Vite
Hours Low riskcreate-react-app has been unmaintained since 2023 and the React team
removed it from the official “Start a New React Project” page. Vite is the
modern equivalent — faster dev server, native ESM, smaller production
bundles, actively maintained.
There’s a community codemod that handles ~90 % of the work:
npx migrate-to-vite@latest craThis guide walks the rest.
Mushi keeps working unchanged through this migration. The web SDK
doesn’t care which bundler ships your app — only the env-var prefix
changes (REACT_APP_* → VITE_*).
Prerequisites
- A working CRA app (
react-scripts≥ 5). - Node 18+.
- Mushi web SDK or React adapter already installed.
Migration checklist
- Step 01Branch off main
- Step 02Run the codemod
- Step 03Review the diff carefully
- Step 04Rename env vars: REACT_APP_* → VITE_*
- Step 05Move public assets
- Step 06Verify index.html is at the project root
- Step 07Update SVG-as-React-component imports
- Step 08Decide on testing framework
- Step 09Re-verify Mushi mounts correctly
- Step 10Remove CRA dependencies
- Step 11Update tsconfig.json types
- Step 12Smoke-test dev + prod builds
- Step 13Submit a test Mushi report
Common gotchas
process.env. Vite doesn’t injectprocess.envat build time. The codemod rewrites the obvious cases; greps forprocess.env.REACT_APP_catch the rest.- Absolute imports without aliases. CRA had implicit absolute imports
via
jsconfig.json/tsconfig.jsonbaseUrl. Vite respectstsconfig.jsonpaths but you must also configure thevite-tsconfig-pathsplugin (the codemod adds it). - Worker imports. CRA used a webpack-specific
Workerloader; Vite uses native?workerURL imports. The codemod won’t migrate workers for you. @craco/cracousers. If you used craco for custom webpack config, port those overrides tovite.config.tsplugins manually.
Rollback
Branched in step 1, so a git checkout main reverts cleanly. If you’ve
already merged and discovered an issue post-deploy, revert the merge —
CRA still builds (it’s just unmaintained, not broken).
Mushi compatibility
The Mushi web SDK and React adapter both work identically on CRA and Vite. The only post-migration change you should observe is faster dev refreshes (Vite HMR is roughly 10× faster than CRA’s webpack dev server) — Mushi hot-reloads cleanly through both.