如何使用angular-CLI在控制台中显示日志 [英] How do I show logs in the console using angular-CLI

查看:124
本文介绍了如何使用angular-CLI在控制台中显示日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为webpack使用angular-cli.

I'm using angular-cli for webpack.

ng服务

ng serve

构建成功,我明白了

** NG Live开发服务器正在 http://localhost:4200 上运行. **
哈希:dd30d5aeee6e21802b4d e时间:9397ms
块{0} styles.bundle.js,styles.bundle.map(样式)163 kB {4} [initial] [rendered]
块{1} main.bundle.js,main.bundle.map(主)6.52 kB {3} [initial] [rendered]
块{2} scripts.bundle.js,scripts.bundle.map(脚本)361 kB {4} [initial] [rendered]
块{3} vendor.bundle.js,vendor.bundle.map(供应商)2.22 MB [初始] [呈现]
块{4} inline.bundle.js,inline.bundle.map(内联)0字节[输入] [呈现]
webpack:捆绑包现在有效.

** NG Live Development Server is running on http://localhost:4200. **
Hash: dd30d5aeee6e21802b4d e Time: 9397ms
chunk {0} styles.bundle.js, styles.bundle.map (styles) 163 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, main.bundle.map (main) 6.52 kB {3} [initial] [rendered]
chunk {2} scripts.bundle.js, scripts.bundle.map (scripts) 361 kB {4} [initial] [rendered]
chunk {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.22 MB [initial] [rendered]
chunk {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
webpack: bundle is now VALID.

似乎没有错.但是访问 http://localhost:4200 时,控制台上没有任何日志.无论如何,我可以打开服务器登录控制台吗?

nothing seems to be wrong. But I don't see any logs on the console when I access http://localhost:4200. Is there anyway I could turn on the server log on console?

推荐答案

您无法将角度代码记录到以ng serve开头的外壳中,抱歉:-(

You can't make your angular code log to the shell that started ng serve, sorry :-(

您只会在该控制台中看到构建错误

You will only see build errors in that console

这篇关于如何使用angular-CLI在控制台中显示日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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