Skip to Content
v0.8.0 · shippedNative iOS / Android / Flutter / Capacitor SDKs, A2A discovery, SOC 2 readiness, residency, BYO storage, BYOK. Read the changelog →
Migration guidesCreate React App → Vite

Create React App → Vite

Hours Low risk

create-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 cra

This 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

Migration checklist
13 required steps
  1. Step 01
    Branch off main
  2. Step 02
    Run the codemod
  3. Step 03
    Review the diff carefully
  4. Step 04
    Rename env vars: REACT_APP_* → VITE_*
  5. Step 05
    Move public assets
  6. Step 06
    Verify index.html is at the project root
  7. Step 07
    Update SVG-as-React-component imports
  8. Step 08
    Decide on testing framework
  9. Step 09
    Re-verify Mushi mounts correctly
  10. Step 10
    Remove CRA dependencies
  11. Step 11
    Update tsconfig.json types
  12. Step 12
    Smoke-test dev + prod builds
  13. Step 13
    Submit a test Mushi report

Common gotchas

  • process.env. Vite doesn’t inject process.env at build time. The codemod rewrites the obvious cases; greps for process.env.REACT_APP_ catch the rest.
  • Absolute imports without aliases. CRA had implicit absolute imports via jsconfig.json / tsconfig.json baseUrl. Vite respects tsconfig.json paths but you must also configure the vite-tsconfig-paths plugin (the codemod adds it).
  • Worker imports. CRA used a webpack-specific Worker loader; Vite uses native ?worker URL imports. The codemod won’t migrate workers for you.
  • @craco/craco users. If you used craco for custom webpack config, port those overrides to vite.config.ts plugins 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.

References

Last updated on