Building a project
When doing local development, we can use the ng serve
command for quick build and deploy cycles on a local development server. But for creating a development build that needs to be deployed somewhere else, we can simply create it using the ng build
command. Here, the build will output the generated files to a /dist
folder whose content can be copied to a web server for deployment. While this is the simplest way to create a build, the output is not production optimized. To create a production quality output, we must create the build with few additional parameters. Here's how you can create a better quality build:
ng build --prod
The --prod
option is actually a meta flag, which encapsulates a few other flags that get activated when creating the build
. The overall effect is we get a lean and optimized output that can then be copied to our web server as static content. When creating a build
with --prod
, you may also want to include the source maps, which are useful to debug...