Updated a React App to Use Vite and Yarn
January 23, 2025Today 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 (read this blog entry that I wrote), 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.
Although you can read my blog entry about how to upload your React App using the Cpanel on Goddady, 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. that may be helpful as well.
Posted by Ninja Space Content. Posted In : react