DEV Community

Discussion on: Is it safe to ship JavaScript Source maps to production?

Collapse
 
ausginer profile image
Vlad Rindevich

I think it's more about the bundle size than a security. When you leave source maps for production the user has to download not only the minified bundle, but also the source map file which contains the source code and the mapping between them. I'd say it's better to ship unminified code than a code with source maps because it eats less traffic.

Source maps are a development tool. It shouldn't be used in production.

Collapse
 
dyw972 profile image
Yohan D.

Agree with that. Thanks.

Collapse
 
prchdk profile image
Pavel Prichodko • Edited

Source maps are downloaded only if your browser has Developer tools opened.

Therefore shipping source maps to production will not affect your end-users and will help your team with the debugging.

Collapse
 
am_rahuls profile image
Rahul

I just tested this with google.com with dev tools opened. I don't see any source maps.

Thread Thread
 
prchdk profile image
Pavel Prichodko

Then Google probably does not ship them at all.