Prefer the last //# sourceMappingURL in a file instead of the first #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
It seems like some Webpack setups (including mine) end up outputting several
//# sourceMappingURL=...
entries when both transpilation and bundling is in the picture.In general it seems like the safest bet to go for the last one, as most tools tend to append the comment to the end of the file.
Thus the last one is most likely to pertain to the last operation that happened, be it transpilation, bundling, or uglification :)
Motivation and Context
In my Webpack setup, stacktrace-gps tries to fetch a non-existent source map because my bundle contains multiple
//# sourceMappingURL=...
entries. This worked fine before #33 was merged, but now stacktrace-gps prefers the first//# sourceMappingURL=...
when the file contains more than one.How Has This Been Tested?
In my own application that uses Webpack and via a new unit test.
Types of changes
Checklist:
node_modules/.bin/jscs -c .jscsrc stacktrace-gps.js
passes without errorsnpm test
passes without errors