"I have finished developing a react app and I used create-react-app to create the web application.what are the steps that I should take to make the app into production? I want to host this application in an Apache server.How can I bundle my app using webpack?
Asked
Active
Viewed 111 times
-2
-
1well here's an article on the same by the create-react-app team: https://facebook.github.io/create-react-app/docs/production-build#docsNav – Daksh M. Feb 21 '19 at 06:11
-
So is it enough to run npm run build? no need to write a script to run my application? @DakshMiglani – Ishara Malaviarachchi Feb 21 '19 at 06:14
-
yes, `npm run build` will create a production-ready build in a folder named `dist` which you can then serve using an http-server, like nginx / caddy / etc. – Daksh M. Feb 21 '19 at 06:15
-
your updated questions seems like a duplicate of this: https://stackoverflow.com/a/42461403/6792646 – Daksh M. Feb 21 '19 at 06:16
-
I saw that question and couldn't understand.so should I run npm run production command as well?could you please elaborate the answer? @DakshMiglani – Ishara Malaviarachchi Feb 21 '19 at 06:18
-
1just run `npm run build`, it'll bundle your code and save it in the `dist/` directory. once you're done with that, just copy the files from dist to the web directory of your apache server, and it should serve. – Daksh M. Feb 21 '19 at 06:19
-
1further more, here's create-react-app's guide on deployment: https://facebook.github.io/create-react-app/docs/deployment#serving-apps-with-client-side-routing – Daksh M. Feb 21 '19 at 06:22
1 Answers
0
run the command npm run build and take the content in the build folder and deploy it on the server.

Ishara Malaviarachchi
- 391
- 6
- 20