Ninja Space Content Tech Blog

Updated a React App to Use Vite and Yarn

Posted by Ninja Space Content on Thursday, January 23, 2025 Under: react

Today for 3 hours in the middle of the night between 2AM - 5AM, I was on a mission to update my react app to use Vite!

I had to use about 3 different resources to get my app to render correctly. In the past, I've only mainly used npm commands and had never used yarn or Vite before so I've beefed up my stack today!

I followed these instructions by slushman to almost a "T".

What I got stuck on was getting my components to render. I had to change how I was importing reactDOM. The line that I had to change to was the following in the main index.jsx file: import ReactDOM from "react-dom/client";

Then, at the end of my index.jsx file, I had to make sure I rendered it like this:

const root = ReactDOM.createRoot(document.getElementById('root')); root.render( .... );

After I was able to get the components showing, I wanted to update my Godaddy Cpanel to reflect the changes that I made immediately. I knew that if I waited for the next day, I might not get to it until way later.

Because I had uploaded a React App on Cpanel before, I only had to change 3 files that were located in the Build folder after I had built it out with the 'yarn build' command! What a night, err...almost morning now! I will have to delete my old files later from the 'public html' directory on Cpanel. I'm currently curious if it'll affect how my pages are served with those old file names still in the directory. However, I'll wait a couple of days before removing them.

Here's another great resource on how to use Godaddy to deploy an app: https://dev.to/crishanks/deploy-host-your-react-app-with-cpanel-in-under-5-minutes-4mf6

In : react 


Tags: react app to vite and yarn  updating old react app to work quickly 

About Ninja Space Content


Ninja Space Content I have been building simple websites on my own since 2008 and currently run several websites at the moment, including this one. I used to be an account manager for an affiliate/e-commerce company, helping affiliates grow their sales so I have some knowledge on the business side and client side of affiliate marketing. During the Covid-19 pandemic, I completed a JavaScript coding bootcamp and graduated in Dec 2020. I've been working as a contractor for a few software companies ever since.
Note: links to resources and promoting special deals may allow me to earn a small commission from each sale.