使用css / javascript源地图在生产中的性能影响? [英] Performance impact of using css / javascript source-maps in production?

查看:151
本文介绍了使用css / javascript源地图在生产中的性能影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 是否应在生产环境中使用源地图?除了调试之外,它们是否提供了任何好处?

  • 由于额外的服务器往返,它们会影响应用加载时间吗?浏览器是否足够聪明,可以在加载并呈现应用后加载 .map 资源?

  • 如果浏览器找不到< c> .map asset( 404 错误),会不会影响性能?


  • 请注意,修复最后一个可能不像提供那么容易,

    解决方案

    使用

    a href =http://www.charlesproxy.com/> Charles Web Proxy 显示,如果开发者工具已打开,源地图只会加载。如果您加载的网页没有开发工具打开,则没有针对源地图的http请求。



    Chrome 43和Firefox 38的行为相同。



    对生产环境。


    • Should source-maps be used in production environment? Do they provide any benefits other than debugging?
    • Do they impact app load time due to the additional server round-trips? Are browsers smart enough to load .map assets after app is loaded and rendered?
    • If a browser cannot find the .map asset (404 error), would there be performance impact? Should I care about fixing it?

    Note that fixing the last one may not be as easy as serving the .map assets if there are complicated concat / minify build steps.

    解决方案

    A quick test using Charles Web Proxy shows that source maps are only loaded if developer tools are opened. If you load a page without dev tools opened, there is no http request for source maps.

    The behaviour was the same in Chrome 43 and Firefox 38.

    So it appears they would be no impact on production environment.

    这篇关于使用css / javascript源地图在生产中的性能影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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