如何在使用angular-cli启用手表的情况下进行构建? [英] How do I build with watch enabled using angular-cli?

查看:79
本文介绍了如何在使用angular-cli启用手表的情况下进行构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想使用服务,我知道它会监视更改,构建和服务. 我想以变化为基础. 根据"ng help",构建采用参数--watch

I don't want to use serve, I know it watches for changes, builds and serves. I want to build upon changes. According to "ng help", build takes parameter --watch

ng build生成您的应用并将其放置到输出中 路径(默认为dist/). --watch(布尔值)(默认:false) 别名:-w --watcher(字符串)

ng build Builds your app and places it into the output path (dist/ by default). --watch (Boolean) (Default: false) aliases: -w --watcher (String)

我尝试了-w和--watcher,但是都给出了错误.

I tried both -w and --watcher but it just gives error.

>ng build -w

Path must be a string. Received null

推荐答案

我不知道这是一个错误还是只是没有记录在案,但似乎您需要添加一个输出路径,以便在使用ng build -o dist -w的同时观看dist是您的输出路径.

I don´t know if it´s a bug or just not documented, but it seems that you need to add a output path for watching with ng build -o dist -w while dist is your output path.

更新:

命令现在为:ng build -op dist -w

更新2:

命令现在为:ng build --output-path dist --watch

这篇关于如何在使用angular-cli启用手表的情况下进行构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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