-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the merging of two sourcemaps #10
Comments
I'm very interested in this after spending many hours trying to produce a correct source map when piping a file through |
👍 I lost hours because of this too believing my code for the regexp-sourcemap package was wrong when it was applySourceMaps that broke everything in my gulp module... |
I wrote a Grunt task that does this, and it works fairly well on my own projects. You could potentially adapt it for |
@floridoo : what are your thoughts on this? |
I was disappointed to run into this today; I have been debugging some pretty basic custom plugins for gulp and finally realized that this module doesn't do what I thought it did. For example, even a very simple gulpfile chain ( The link John posted above looks like it does it "correctly", but I'd much prefer a tool that lets me continually update the inline source map for each file correctly, rather than having to write out individual maps for each step in the chain and merge them all at the end. At risk of stating the obvious, just for anyone finding this in the future, the issue is that if you take two example source maps, let's say, one for ts->js and one that further modifies the js:
What you want if you apply source map B to source map A is this final result:
Instead, what the current implementation gives you is this, which the browser generally has no idea what to do with:
|
Another option could be that I am simply doing it wrong; for example, I'm assuming it's safe (that is, a no-op) to write out "no change" source maps that map line 1 to line 1, line 2 to line 2, etc. An example is https://github.com/elliot-nelson/gulp-strip-import-export/blob/master/index.js#L19. However, maybe because I am writing out a "no-change" source map with higher resolution than a previous source map, I'm accidentally forcing the bad behavior I see in my post above. |
It seems like the
applySourceMap
method of the source-map project produces the minimum of the two provided source-maps, which is probably not what most people expect it to do (for example, concat and uglify don't work well together).I'm working on an improved algorithm for applying one sourcemap to an existing sourcemap, which this project might be better of using.
The text was updated successfully, but these errors were encountered: