Currently I made a simple app with react, it works perfectly and I use react-scripts. I installed React by following the Facebook github page, and it written that "When you're ready to deploy to production, running npm run build will create an optimized build of your app in the build folder. ". After I press npm run build, a folder build created, but I do not know what to do with this folder. I tried some method like, move all folders except build and npm run, but it did not work. Anyone can explain me what is this folder "build" ? Thank you
-
You can figure this out by looking at package.json fileVolem– Volem2017-07-26 08:05:59 +00:00Commented Jul 26, 2017 at 8:05
-
yeah, but it calls react-scripts which I dont know what this script doing, Thanks btwuser8152941– user81529412017-07-26 08:10:37 +00:00Commented Jul 26, 2017 at 8:10
Add a comment
|
1 Answer
npm run build builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
npm run build creates a build directory with a production build of your app. Set up your favourite HTTP server so that a visitor to your site is served index.html, and requests to static paths like /static/js/main..js are served with the contents of the /static/js/main..js file.
5 Comments
Voi Mập
after npm run build you can open your app with your cmd with npm start :D. Easier you can read this page github.com/facebookincubator/create-react-app#create-react-app-. ^^ . All is already explained ^^
Voi Mập
have you used "npm run build"
I did, this is the message after I run build: Creating an optimized production build... Compiled successfully. File sizes after gzip: 49.4 KB build/static/js/main.2df24179.js 173 B build/static/css/main.4f0bb42e.css The project was built assuming it is hosted at the server root. To override this, specify the homepage in your package.json. For example, add this to build it for GitHub Pages: "homepage" : "myname.github.io/myapp", The build folder is ready to be deployed. You may serve it with a static server: npm install -g serve serve -s build