javascriptreactjscpanelweb-deploymentvite

How to deploy a react + vite app to a private hosting with cpanel?


Im currently learning web dev so I wrote a tasklist app using React + Vite in VSCode. You can see it here: https://github.com/AdSaMo/react-tasklist

In Vite's documentation you can find several ways to deploy an app (Git-hub pages, Netlify, etc...) but that's not what I was looking for.

The problem comes when I want to deploy it in a private shared hosting. I've got a domain and a hosting in Sered and I would like to deploy it there. I have seen some posts talking about pasting everything inside build folder in to the public_html folder via cpanel.

However, as I'am using Vite when I run "npm run buld" I don't get a "build" folder but a "dist" one.

I am not sure but I guess structure is different, so when I include what's inside of dist folder into public_html and I type the URL in my browser nothing shows up. Just a white screen with some errors in console:

What shows up

When that's what it should be like: https://adsamo.github.io/react-tasklist/

Anyone knows how could I have this app with dist folder instead of build folder in my domain and hosting via cpanel?

Thanks all!

PD: Im pretty new, so pls have mercy xD


Solution

  • I managed to fix it. I just had to upload it normally via cPanel. The problem was that href was wrong (wrong path) in index.html