What is the difference between ng serve and ng build?
Model answer
ng serve starts a local development server with live reload: it rebuilds in memory when you save a file and is meant for development only. ng build writes the finished files to the dist folder, optimised and minified when you use the production configuration, ready to be deployed to a web server.
You never deploy the output of ng serve. You deploy the dist folder produced by ng build.
Learn this topic
Angular Tutorial: Beginner to Advanced .
Sign in to add your own answer.
More questions
- What is Angular, and how is it different from AngularJS?
- What is a single-page application (SPA)?
- What does the Angular CLI do? Name some common commands.
- What is a standalone component, and why did Angular move away from NgModules?
- What is TypeScript, and why does Angular use it?
- Describe the structure of a basic Angular project.