Recently I published a new open-source Webpack loader named
smart-source-map-loader to enable Webpack to load the source maps from existing compiled code. Now you might be thinking, there’s already a loader for that, what makes this alternative “smart”?
Well, that loader has some major usability problems. In addition to some questionable parsing code and a tendency to add absolute paths into the source maps, there is a long-standing issue where the source paths end up being very different from the path to the original source file. This issue is briefly discussed here, but basically the loader passes the path from the map directly into Webpack unaltered, which is almost always the wrong path in almost all cases. In addition to being the wrong path, this leads to conflicts in the resulting source map where one source will overwrite another files source and produce a bad or even unusable source map.
With no fix in sight, and a pressing need to have this issue corrected, I set out to resolve the issue. I started out with a fork of the loader trying to fix the wrong paths issue, but while I was debugging the issue I determined this and some other issues I discovered along the way would require massive changes to fix, so I decided a total rewrite would be simpler and faster. So with that, this loader was born!
I’ve been using this loader in a project of my own, and it works great! So if
source-map-loader is giving you trouble, try