Always output source maps
See original GitHub issueDescribe the issue
Currently, source maps are only written in development (using gulp-if
and !PRODUCTION
as condition). This makes it harder to inspect the code of the live site in the browser’s DevTools and as far as I see doesn’t really have any advantages, the code is open source anyway.
Suggested change
Shipping source maps makes it easier to inspect and debug code on the live site and also is nice for beginners who might want to take a look at the website’s code to discover how something was implemented. 😃
So I suggest removing the guarding calls to $.if()
that currently wrap $.sourcemaps.write()
as well as the condition for the devtool
webpack config.
I’d be happy to submit a PR if you agree. 😃
Internal Tracking ID: EXPOSUREAPP-12958
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
There is no way to serve source map files separately #783
But webpack always places source map files within output dir and uses relative paths as urls for them. There is no way to...
Read more >Should I Use Source Maps in Production?
You should always have map files, and especially if you're working in production. But there is a difference between having map files and...
Read more >4 Reasons Why Your Source Maps are Broken
4 Reasons Why Your Source Maps are Broken · Missing or incorrect source map directive · Missing original source files · Bad source...
Read more >What are Javascript Source Maps?
It's generally a good practice to minify and combine your assets (Javascript & CSS) when deploying to production. · Source maps create a...
Read more >Improving Development with Source Maps for Debugging
The DevTools of all modern browsers offer built-in source maps. These source maps enable DevTools functionality like debugging with breakpoints ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jonaskuske Thanks for your suggestion. Now implemented. Best wishes, DS
Corona-Warn-App Open Source Team
@MikeMcC399
In theory, you should never have to debug in production. But in reality, it happens all the time since most users don’t run our project locally anyways.
There’s no security risk to shipping source maps to production since the code is open-source as @jonaskuske mentioned already. If a person thinks that code obfuscation is a reliable form of security then they already have a problem.
So from my point of view, we are good to proceed to bring the source maps to production.
It will add some megabytes to the package but the maps will only be downloaded with dev tools opened.