首页 > 解决方案 > 在 ReactJS 应用程序的生产环境中添加源映射对性能有影响吗?

问题描述

由于额外的服务器往返,源地图是否会影响应用程序加载时间?如果我们删除/禁用源映射,那么会有任何性能/应用程序加载时间优势吗?

它还会增加捆绑包的大小吗?

谢谢,拉梅什

标签: javascriptreactjsperformancecreate-react-app

解决方案


Here is a link to MDN on the subject, https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Use_a_source_map

If you are adding the source maps via the commented notation, then no there will be zero impact, other than the weight of the bytes added by the comment :-)

But if you add source maps as a resource in a JavaScript file or in your HTML, then yes, the browser loads all resources linked to.

I hope that makes sense.


推荐阅读