Member-only story

This week, I migrated an old React 15 Create React App (CRA) project from 2017 to Vite. Here’s what I learned along the way.

Shruti Kapoor
1 min readFeb 21, 2025

--

Watch the livestream to see this migration LIVE

1. Outdated React Version (React 15)

Vite auto-installs React 19, but my app was still on React 15. I was concerned that I’d need to incrementally upgrade to React 17+ before migrating.

Solution:

Downgrading Vite’s React version to 15 before migration was straightforward. I simply removed node_modules and replaced createRoot with the older ReactDOM.render.

2. Removing Create React App

The first step was to remove CRA. Since my project was using CRA’s built-in Webpack and Babel settings, I ejected the configuration:

npx react-scripts eject

This exposed Webpack and Babel configs, making it easier to transition to Vite.

3. Module Import Errors (Cannot use import statement outside a module)

Vite uses ES Modules (ESM), while CRA relied on CommonJS, causing import issues.

Solution:

  • Added "type": "module" to package.json.
  • Updated <script src> tags in index.html to include type="module".

4. Dependency Vulnerabilities and Security…

--

--

No responses yet