How to deploy a create-react-app to a web host (e.g. Siteground)?

I am creating a response project using the create-react-app and trying to figure out how to deploy my code to my hosting server on Siteground.

Does anyone know a better way to do this? Am I importing a build folder via FTP? Can I automate the process through GitHub?

Thanks in advance!

+5
source share
3 answers

In create-react-app docs, you run npm run build and basically just take the output and FTP it to your web server.

However, your question is very broad: you can automate it using GitHub or some other tool, but it really will bring peaceful answers to StackOverflow (which is not a suitable forum for such questions).

+3
source

Usually host providers are managing strategies.

Example:

Create Heroku Create React Assembly

S3 cloudfront

Otherwise, you will have to manage it yourself by registering a custom script assembly that will act with:

npm run build

And then move the build folder. If you use Maven, you can control the entire assembly using plugins, for example:

Frontend Maven Plugin

+1
source

npm run build or yarn build

Creates a production application in the build folder . It correctly binds React in production mode and optimizes assembly for better performance.

npm run build creates a npm run build directory with the production build of your application. Set up your favorite HTTP server so that your site visitor serves index.html and requests for static paths such as /static/js/main.<hash>.js are presented with the contents of the file /static/js/main.<hash>.js .

source: create-react-app

+1
source

Source: https://habr.com/ru/post/1274936/


All Articles