Is there any performance impact of adding source-maps in production in ReactJS application?

Viewed 899

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?

2 Answers

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.

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.

Related