当你 运行 服务时会发生什么?

What happens when you run ng serve?

最近一段时间我一直在使用 Angular-CLI。它带有许多命令,包括 ng serve 可在 localhost:4200.

启动服务器

我习惯使用 Grunt 和 Gulp 可以根据我的需要进行配置。我想配置 Angular-CLI 的服务器,但后来我意识到我不知道它是什么或如何配置它。 Grepping serve 的项目没有发现任何有用的东西。

那么,ng serve 到底是做什么的?

如今,它使用 webpack-dev-server 启动本地网络服务器。参见

来自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.


原回答:

经过一番研究后,我收集到了这些内容。

Angular-CLI 搭载了 Ember CLI 的某些东西。 ng serve 似乎就是其中之一。 Ember 有一个 ember server 命令,它在 this file 中定义并且似乎与 ng serve.

的行为相匹配