Hello Fellow Developers welcome back to another react blog. In this blog we will learn about what is a production build and how to create a production build on a existing react app.
The production builds creates bundles, lighter-weight source maps, and optimized assets. This also improves the load time. React also recommends using production mode while deploying the react app. Production build helps in optimizing performance. Let’s see now how to create react app in production mode.
Now lets take an example of a newly created react app without making any changes in that we will create a production build of the given react app.
Now to create a production build write following command in your terminal.
npm run build
This will create a production build for you in a new folder name build
This is what data in you build folder will look like:-
Now to start your production build you need to have a npm package called serve again write following code in your terminal:-
npm i serve
Now to start your code
npx serve -s build
You can see your production build in your local host 3000