如何在Angular-CLI 6+中忽略源地图 [英] How to omit sourcemaps in Angular-CLI 6+

查看:62
本文介绍了如何在Angular-CLI 6+中忽略源地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ng build进行构建而没有源地图.在以前的版本中,我可以使用--no-sourcemap--sourcemap=false参数,但是现在我得到了:

I want to build with ng build without sourcemaps. In previous versions, I could use the --no-sourcemap or --sourcemap=false parameter, but now I get:

Unknown option: '--sourcemap'

如何在Angular-CLI 6+中忽略源地图?

How can I omit source maps in Angular-CLI 6+?

推荐答案

使用--source-map.它采用默认值true.因此,以下命令将不会创建源地图:

Use --source-map . It takes default value true. So following command will not create sourcemaps:

ng build --source-map=false

类似地,--prod避免默认情况下创建源地图,但是如果要创建,则只需在最后使用--source-map即可创建源地图.

Similarly --prod avoids creating sourcemaps by default but if you want to create then just use --source-map in the end to create sourcemaps.

关注> 官方文档

更新:

对于Angular cli 7,请在下面使用:

For Angular cli 7 use below:

ng build --sourceMap=false

如果要使用生产配置&生产产品,捆绑(因此不希望将sourcemap包含在build文件夹中),然后使用:

And if you want prod build with production config & bundling (thus don't want sourcemaps included in build folder) then use :

ng build --prod=true

最近 官方文档

这篇关于如何在Angular-CLI 6+中忽略源地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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