What happens when you run ng serve?

AngularAngular Cli

Angular Problem Overview


I've been using Angular-CLI for the last little while. It comes with a number of commands including ng serve which spins up a server at localhost:4200.

I'm used to using Grunt and Gulp which can be configured to suit my needs. I wanted to configure Angular-CLI's server but then I realized I didn't know what it was or how to configure it. Grepping the project for serve hasn't unearthed anything that seems useful.

So, what exactly does ng serve do?

Angular Solutions


Solution 1 - Angular

Nowadays, it uses webpack-dev-server to start a local webserver. See this question.

From the docs:

> The CLI supports running a live browser reload experience to users by running ng serve. This will compile the application upon file saves and reload the browser with the newly compiled application. This is done by hosting the application in memory and serving it via webpack-dev-server.


Original answer:

After some research here's what I've gathered.

Angular-CLI piggybacks certain things off of Ember CLI. It would appear that ng serve is one of those things. Ember has an ember server command which is defined in this file and seems to match the behavior of ng serve.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJason SwettView Question on Stackoverflow
Solution 1 - AngularJason SwettView Answer on Stackoverflow