微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

[Angular] Debug Angular apps in production without revealing source maps

Source: https://blog.angularindepth.com/debug-angular-apps-in-production-without-revealing-source-maps-ab4a235edd85

 

Build application with source map:

"build": "ng build --prod --source-map",

 

But Now the source maps would be revealed in production. To hide them we simply create another folder in our dist and move the source maps to it.

"postbuild": "mkdir dist/sourceMapInspector/sourceMaps; mv dist/sourceMapInspector/*.map dist/sourceMapInspector/sourceMaps"

 

In production,we can find the source map by manully enter the source map url on server,then use ‘Add source map‘ from Chrome dev tool to add source map in our production app.

Then we can debug it as normal as in the developement env.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐