DEV Community

Cover image for Migrate React project from create-react-app to Vite.js
Wojciech Wernicki
Wojciech Wernicki

Posted on • Originally published at

Migrate React project from create-react-app to Vite.js

Recently I had to replace create-react-app with Vite.js in one project at work. This is a thread of what I did to make that work:

Remove CRA & install Vite.js

This is pretty straight-forward, I uninstalled CRA and installed Vite.js packages. I followed an example for react-ts available at Vite documentation1.

Add support for tests (Jest, React Testing Library)

That one was tricky, but thanks to 2 articles2 3 on Medium (I will link to privacy-friendly versions) I managed to run tests.

Vite config

95% of config was easy to set up, the only thing I had to search online was how to force Vite into using HTTPS with some sort of certificate. It was possible with vite-plugin-basic-ssl4.

All set up!

It took me about an hour to set up Vite.js into desired configuration to allow that specific React+TypeScript project into running. I hope it will also help you to kickstart your migration CRA => Vite.





Top comments (0)