How can I specify a file source map after the page loads up?

一个人想着一个人 提交于 2019-12-10 13:19:44

问题


I'm a big fan of source maps for javascript and SASS; however, I don't want to load source maps into production for a couple of reasons: the original source code is available and it's not a good use of bandwidth.

But, sometimes, the need for debugging in production arises (we've all seen production-only bugs on the front-end).

Is there a way for me to specify a source map after the fact? For example, I could have a source map available locally or behind a VPN-locked server, or even in a folder that's not visible to the user. I'm fine with doing it at run time or specifying a setting and having to reload the page. (actually if I could persist that setting that'd be even better).


回答1:


You can right-click on a minified source file and select "Add Source Map". Then paste in the URL of the map file.

If your mappings file doesn't include the original file contents alongside the mappings make sure the original file paths are accessible to Chrome.



来源:https://stackoverflow.com/questions/36204497/how-can-i-specify-a-file-source-map-after-the-page-loads-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!