如何在 Angular-CLI 6+ 中省略源映射 [英] How to omit sourcemaps in Angular-CLI 6+

查看:22
本文介绍了如何在 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:

未知选项:'--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

如果你想使用生产配置和生产配置构建产品捆绑(因此不希望在构建文件夹中包含源映射)然后使用:

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天全站免登陆