Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I deploy my ReactJS app on a regular host?

I've seen many guides where people teach you how to deploy your react app on services like digital ocean, heroku, GitHub Pages, aws. But I'm wondering if I can deploy my React app (create-react-app) which consists of only front end in a host service like 000webhost or Ipage? Because a person wants me to design a website, and he says that he already has a domain name and a host service in lpage.

like image 674
Julio Avatar asked Jun 16 '17 17:06

Julio


People also ask

What is the best way to deploy React app?

If you want to deploy React app, you need to drag and drop the build folder onto the Netlify Dashboard. Run npm run build or yarn build before deploying the latest build. If everything was done correctly, you will need to see the next screen.


2 Answers

I use webpack to bundle my react app. So at the end react app will be:

  • one bundle (rarely more if you use dynamic bundle loading - probably not), that is just a javascript file
  • your index.html that includes this file at the end of body
  • and your .css that you can set in principle in one file (or separate folder with several files) and include at the top of your index.html

Regarding .css there are several better ways how to include, but you can likely start with simple setup as mentioned above.

So you just put these 3 things on your server, and your app is available at index.html.

P.S. Don't know what is Ipage, and haven't worked with create-react-app.

like image 188
croraf Avatar answered Nov 07 '22 12:11

croraf


Run 'npm run build' from your command line folder where your project is located. Copy files from the 'build' folder that is created and upload them in your host's root folder or equivalent. Takes less than a minute.

like image 7
ZStoneDPM Avatar answered Nov 07 '22 12:11

ZStoneDPM