loading...
Cover image for Deploy react app on shared hosting

Deploy react app on shared hosting

qasimnadeem profile image Qasim Nadeem ・1 min read

For deploying a react app on a shared hosting you need to create a production build. Production build is a pack of all your react code and its dependencies.

in most shared hosting we put our site/app inside a public_html directory so if we hit www.yourdomain.com it serves the code from public_html directory.

so if your react app is ready to go, edit your package.json file add a new key value:

"homepage":"http://yourdomain.com"

then create a build using following command:

npm run build

after running the command you will see a new directory named build in your app root. It will contain js and css for the app and a index.html file. You need to upload all the content inside build directory to public_html directory, and that's all, go to your domain and your app will be working just fine.

Discussion

pic
Editor guide
Collapse
delc82 profile image
dleon

Thanks for this!

Collapse
thisdotmedia_staff profile image