---
title: "Discussion on \"Migrating from Create React App (CRA) to Vite\" | Hashnode"
description: "Discussion on \"Migrating from Create React App (CRA) to Vite\". Learn how to migrate your CRA app over to Vite."
url: "https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Migrating from Create React App (CRA) to Vite](https://cathalmacdonnacha.com/migrating-from-create-react-app-cra-to-vite?utm_source=hashnode&utm_medium=feed)

Learn how to migrate your CRA app over to Vite.

Aug 22, 2022 · 7 min read · cathalmacdonnacha.com  
Updated Nov 27, 2024  
Read the article

-   [#vite](https://hashnode.com/tag/vite)
-   [#create-react-app](https://hashnode.com/tag/create-react-app)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

@cathalmacdonnacha · Ireland 🇮🇪

  
[View profile](https://hashnode.com/@cathalmacdonnacha)

Follow me on my journey as I write about tech topics I face in my everyday life as a Frontend Developer 💻

## Responses 20

Markdown supported · ⌘↵ to post

[Saba Kauser](https://hashnode.com/@sabakauser)

[Oct 18, 2024](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/67122453bf29f4cb0b923f50)

Is there a step required if my project uses craco ?

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Nov 3, 2024](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/67122453bf29f4cb0b923f50#reply-67280736081c9f4523680a02)

Sorry, I've never used craco.

[Francesco](https://hashnode.com/@rpk67u)

[Oct 29, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/653e36b17e48109905e3607e)

Great article, thank you very much! It saved me from a lot of headaches 🍻

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Oct 29, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/653e36b17e48109905e3607e#reply-653e400675a4d299aca3589b)

Great to hear Francesco!

[Đồng Đặng Minh](https://hashnode.com/@Koo199x)

[Sep 28, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/65152aa6f80d7d64789779dd)

Just note, vite-plugin-svgr package was release version 4, so if you install this version it won't work with syntax in this blog. You should downgrade to verion 3.3.0

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Oct 2, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/65152aa6f80d7d64789779dd#reply-651ae5b96b3bc781290725b4)

[Đồng Đặng Minh](https://hashnode.com/@Koo199x) I just updated it. Can you check if it looks ok?

[Đồng Đặng Minh](https://hashnode.com/@Koo199x)

[Oct 4, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/65152aa6f80d7d64789779dd#reply-651d369fc64d5e99595a0fe4)

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha) Syntax is look good for library's version latest, but I don't think it will be used for most developer. So I suggest this section should be show the both syntaxs of version 3.x and 4.x

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Oct 4, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/65152aa6f80d7d64789779dd#reply-651d3deac64d5e99595a110b)

[Đồng Đặng Minh](https://hashnode.com/@Koo199x) I imagine anyone migrating from CRA to Vite will be using a fresh installation of Vite, therefore picking up the latest version of svgr.

[Rob van der Leek](https://hashnode.com/@robvanderleek)

[Aug 21, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/64e32fbca217febb97163de2)

Excellent migration guide from CRA to Vite 👌

[Terence ezenyili](https://hashnode.com/@terrace)

[Jul 1, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/64a018128db091c40103331a)

Vite is a lot faster. 💨

[Dhruv Khandelwalal](https://hashnode.com/@dhruvfeugo21)

[May 26, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/6470cdcb9668d67eeed11fc1)

I am getting a blank screen after running yarn run dev. I moved my index.html to the root of the folder and added the script but nothing is working.

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Oct 29, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/6470cdcb9668d67eeed11fc1#reply-653e405475a4d299aca358a2)

Hey Dhruv, did you manage to get this working?

[Yagnesh Virani](https://hashnode.com/@MrOnline)

[Apr 11, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/64358fae6699be6a40d4dd0a)

10/10 hearts! Worked flawlessly. Migrated Refine app from CRA to Vite.

Updated scripts to - `{     "start": "refine run vite",     "build": "tsc && refine run vite build",     "serve": "refine run vite preview",     "refine": "refine"   }`

Thereafter `npm start` did show empty white page for a long time but soon after the content displayed

[Jan Paepke](https://hashnode.com/@janpaepke)

[Mar 29, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/642449256243e99ff0d55d8e)

Just followed your guide to sucessfully migrate to vite. It's so fast and I'm really happy to finally have gotten rid of cra. (not being able to update to ts5 was the final straw).

Here's a tipp though: Vite recommends using `vite-plugin-checker` for checking types. I also added it and it works great. This removes your only "disadvantage".

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Mar 29, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/642449256243e99ff0d55d8e#reply-642449886243e99ff0d55daa)

Excellent thanks. This wasn't available at the time of writing so happy to see that!

[Josh Schneider](https://hashnode.com/@Josh68)

[Mar 31, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/642449256243e99ff0d55d8e#reply-64276f51af5048c992b6e5bf)

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha), I just found the same thing after searching around Vite docs. Maybe you could just update your post to mention it? Thanks for the helpful post!

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Apr 11, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/642449256243e99ff0d55d8e#reply-643529846699be6a40d4bcac)

Thanks [Jan Paepke](https://hashnode.com/@janpaepke). I still see it as a disadvantage since it's not built into Vite itself. However, I've mentioned it as an option. 👍

[Malin Hanák](https://hashnode.com/@Mallan)

[Feb 24, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63f8957b207712e9dab0697e)

I don't know if it is alright to ask questions here, but I have migrated on of my CRA's fully to vite now, following this amazing guide. But I am running into problems when it comes to building it for productions, whenever I run it in productions it cannot find the files in assets folders, it fails with 404. I think this is because the index.html script and link tags are missing a leading . to the paths but I cannot find anywhere on how to configure vite fix this issue. Have you any ideas?

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Feb 24, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63f8957b207712e9dab0697e#reply-63f89680207712e9dab069ba)

Hey Malin, I think this question would be best placed on Stack Overflow as it will be difficult to help without code examples, screenshots etc.

[Malin Hanák](https://hashnode.com/@Mallan)

[Feb 27, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63f8957b207712e9dab0697e#reply-63fc7274a13f5e02f6799e1e)

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha) Thank you, fully understand!

[Matthew Wells](https://hashnode.com/@mwells)

[Feb 24, 2025](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63f8957b207712e9dab0697e#reply-67bc5df4628ad12e0f8d8f4b)

[Malin Hanák](https://hashnode.com/@Mallan) Did you ever resolve this or find out what the issue was? I'm having similar issues and get strange behaviour with different scenarios - Did you create a stack overflow question and have a possible link?

[Alex Sweeney](https://hashnode.com/@ajs1998)

[Feb 18, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63f071bda7e6ca7a328c8365)

This is probably a long shot, but do you know why my page is totally blank now? There's no content in the root div, almost no console logs, and no network activity.

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Feb 18, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63f071bda7e6ca7a328c8365#reply-63f086ec0e63a77a616fd12e)

Have you tried #3 under the Troubleshooting section?

[Alex Sweeney](https://hashnode.com/@ajs1998)

[Feb 18, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63f071bda7e6ca7a328c8365#reply-63f0f28e34c25f8061773a82)

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha) Yep, and I know that worked because I can see the root div, there's just nothing in it. IntelliJ also isn't happy about the `/src/index.tsx`, it thinks it doesn't exist and I think it's trying to look from the public folder. IntelliJ stops complaining when I change it to `src/index.tsx`, but the page is still blank. Also the link you added to the troubleshooting docs is broken. Our app is not open source and I can't make it open source :/ I knew this might be a long shot, but its hard to debug when there's no error messages or anything...

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Feb 24, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63f071bda7e6ca7a328c8365#reply-63f898f75ebda1e9aa53b9ab)

[Alex Sweeney](https://hashnode.com/@ajs1998) No worries. I updating the link to the troubleshooting docs, thanks for that!

[Malin Hanák](https://hashnode.com/@Mallan)

[Feb 16, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63edd2d39612405e16d13a6d)

This was a great article, I read it because I wanted to know about this migration as it very relevant my my work place and it up fixing and completely different vite issue I have had for weeks, with the resolve.alias config! AMAZING

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Feb 16, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63edd2d39612405e16d13a6d#reply-63edda693c9c765be7a43c3f)

Great to hear it helped Malin. 👍

[Paul Derbyshire](https://hashnode.com/@proddy)

[Feb 8, 2023](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63e3bbcb1207cada0eeaca42)

very useful, I switched from CRA too and already seeing the benefits

[Bob O'Toole](https://hashnode.com/@bobgravity)

[Dec 6, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/638e9124895a9daa034fcaee)

nice! now my homepage won't render and i f_\*_ed up my whole app!

[Bob O'Toole](https://hashnode.com/@bobgravity)

[Dec 6, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/638e9124895a9daa034fcaee#reply-638e91c8895a9daa034fcb06)

lol jk. got it working. thanks!

[Matthew Beadlecomb](https://hashnode.com/@Beadle)

[Nov 16, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63751006cc42566334374695)

Thank you so much for this easy to follow post. I had been wanting to make the switch from CRA to Vite for a while but I was worried it would take me a long time. After reading your article I made the switch in about 3 hours!!

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Nov 16, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/63751006cc42566334374695#reply-637511b9e1d53a5fd290e7cb)

Great to hear Matthew! Glad you found the article useful.

[Freddie](https://hashnode.com/@frederico)

[Oct 24, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/6356c6c62ff8c6f14ba7e35d)

Worked wonders, thanks!

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Oct 24, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/6356c6c62ff8c6f14ba7e35d#reply-63571fae2ff8c6f14ba7e94a)

Glad you found it useful Freddie.

[Tayo Ishola](https://hashnode.com/@neocoder)

[Sep 24, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/632e9cf93ac18d0d78a01439)

Great article

I think you should update `jsx` key of tsconfig.json to

```
"jsx": "react-jsx"
```

to prevent typescript errors like

`'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.`

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Sep 27, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/632e9cf93ac18d0d78a01439#reply-6332bf5cc732084860086201)

Updated, thank you for that. 🙏

[Andrew Baisden](https://hashnode.com/@andrewbaisden)

[Sep 10, 2022](https://hashnode.com/posts/migrating-from-create-react-app-cra-to-vite/630351878cb53b2c16267c8a/comment/631c7badf73f4734bc054137)

Awesome, I also made the switch from CRA. Now I am using Next.js and Vite.
