How to Deploy React app on Regular server without build command - reactjs

I want to Deploy my react site to the regular server without build command
without Netlify or DigitalOcean, Heroku, GitHub Pages, aws
Is there a way to run modular bundlers like Webpack on Host?
actually what Netlify or DigitalOcean, Heroku, GitHub Pages, aws doing for show webpage without npm run build command?

Related

what is the optimal way to deploy a React app after building it

I've run into some confusing issues when I try to deploy my React app.
I want to deploy my app for production and I would like to know what is the optimal way.
I already tested it with Heroku, but Heroku doesn't walk you through many details, I just had to link my GitHub repo and Heroku does the rest.
I ran 'npm run build ' and tried to deploy the app and run it on localhost, just to see what it would look like, but unfortunately, it does not work:
log

Deploy a React app to Netlify + AWS Amplify

So I have this normal React app that is deployed in Netlify.
Then I tried using AWS Amplify for my authentication. All went well in my local.
The problem is, I think I would not be able to deploy it properly to Netlify anymore because of the aws-exports.js that is dynamically generated. Or can I? Is it still possible to deploy a React + Amplify app to Netlify? Or I have no choice but to deploy it to AWS?
UPDATE: I was able to deploy it successfully on Netlify by commenting out the aws-exports.js in the .gitignore. The problem now is how could I have different version of the file for different environments (e.g. Dev, Stage, Prod).

Do you need a web server to run a production build of a react app on a VPS?

I have built a react app using a truffle box that uses create-react app. I can get the app running on my local host but I can't see it on my VPS when I go to the IP address of my VPS and I run exactly the same commands and I get the same output in the terminal. I go in to my client dir and run npm start. I have tried to make a build and run the build through an http server in the client dir and the root folder of the VPS.
I run
serve -s build
All I can see is the index of the build in the browser when I try and serve the build through a webserver. When I run npm start on my localhost I can view my app but it doesn't work on my VPS. Please help me I've been struggling with this for days and its the last part of my project.
You need a webserver in any case.
When you do a local development, you do use webpack dev server (which is inside of create react app).
For the production, you need to make a production build and serve it for example by nginx. Here some details how to create production build with CRA https://create-react-app.dev/docs/production-build
On your screenshot, you don't see your site, because there is no entry point in your folder. By default it should be index.html

How to build react app for production without making the website offline?

Is it possible to build react app for production using npm run build without it making the site offline? I am using nginx to serve the react app and when I run the above command, I get Internal server error until the build is finished. It would be nice if the old version of the app is served until the build is finished.
You shouldn't be building your application on the production server. Build it locally, then deploy it to production and this won't be an issue.

React App Hosting - Host Prerequisites

Generic: What kind of services must a hosting vendor provide in order to make it possible to have a React app hosted?
More Specific: If I create a website with React and React Router, is it possible to deploy it by just uploading the bundled output folder? This could be for example a dist folder containing index.html, bundle.js and an images folder.
Could this be as simple as deploying a simple web page (like one built with plain HTML, CSS and JS)?
Sure just do: npm run build
and you will have a folder with the static files. Upload those with your choice of file transfer method and set the permissions to the web host appropriately.
100% Working Example.
React App Hosting in Firebase .
You can read this blog
Host Your React Web App in few minutes.
Command runnning in Wrong sequence =>
firebase login
firbase init
firebase deploy
npm run build
Command runnning in Correct sequence =>
firebase login
firbase init
npm run build
firebase deploy

Resources