当您进行服务时会发生什么? [英] What happens when you run ng serve?

查看:62
本文介绍了当您进行服务时会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近一段时间我一直在使用 Angular-CLI .它带有许多命令,其中包括ng serve,可在localhost:4200旋转服务器.

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.

我习惯使用Grunt和Gulp,可以对其进行配置以满足我的需求.我想配置Angular-CLI的服务器,但后来我意识到我不知道它是什么或如何配置.为项目serve收拾东西并没有发现任何有用的东西.

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.

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

推荐答案

现在,它使用webpack-dev-server启动本地Web服务器.请参阅此问题.

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

来自 docs >:

CLI支持通过运行ng serve向用户运行实时浏览器重新加载体验.保存文件后将编译该应用程序,并使用新编译的应用程序重新加载浏览器.这是通过将应用程序托管在内存中并通过 webpack-dev-server来完成的.


原始答案:

经过一番研究,这是我收集到的东西.

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

Angular-CLI从Ember CLI附带某些东西.看来ng serve是其中之一. Ember具有ember server命令,该命令在中定义该文件,并且似乎与ng serve的行为匹配.

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.

这篇关于当您进行服务时会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆