如何使用 angular-cli 启用 watch 进行构建? [英] How do I build with watch enabled using 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 启用 watch 进行构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!