2

Do the source maps impact application load time due to the additional server round-trips? if we remove/disable the source map then will there be any performance/application load time benefit?

Will it increase the bundle size also?

Pavindu
  • 2,684
  • 6
  • 44
  • 77
Joshi
  • 101
  • 2
  • 9
  • 1
    Anything added increases the time to load or initialize anything. – Bren Jul 09 '20 at 00:24
  • 1
    But I heard 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. – Joshi Jul 09 '20 at 00:31

2 Answers2

2

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.

rexfordkelly
  • 1,623
  • 10
  • 15
-1

Yes. Depending on the complexity of your code source maps significantly increase the entire project size leading to longer load time.

In one project I worked with removing source maps reduce the download size by more than half - doubling the load speed. Your mileage may vary however.

slebetman
  • 109,858
  • 19
  • 140
  • 171
  • 2
    But I heard 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. – Joshi Jul 09 '20 at 00:31