Step 20
It is time to deploy our application for production. However, first, we must "build" the suitable production bundle to be served over a static hosting service.
Stop the development server and run the following command:
npm run build
The build command will generate an optimized build of your web application, ready to be deployed. The generated artifacts will be placed in the dist
folder.
Open the dist
folder and explore its content. In particular, note how there is only one .js
file inside dist/assets
. This single JavaScript is a minified version of our entire JavaScript code.
To preview the application in production, you can use the following command to serve it locally from the dist
folder:
npm run preview
The production-ready app will be previewed on http://localhost:3000/.