Fix sources: ["0"], output the correct source#140
Merged
stefanpenner merged 2 commits intoember-cli:masterfrom Apr 16, 2019
Merged
Fix sources: ["0"], output the correct source#140stefanpenner merged 2 commits intoember-cli:masterfrom
stefanpenner merged 2 commits intoember-cli:masterfrom
Conversation
Case 1, sourcemap missing In [terser-js](https://github.com/terser-js/terser#source-map-options), sources are always 0 if old sourcemaps are not provided. The value passed for sourceMap.url is only used to set //# sourceMappingURL=out.js.map in result.code. The value of filename is only used to set file attribute in source map file. In broccoli-uglify-sourcemap we know in this case we are generating sourcemap for the file we are processing, changing 0 to the actual file gives us the correct source. Case2, multiple sourceMap comments source-map-url only matches the very first magic comment so we mistakenly thinks the js file doesn't have a valid sourcemap.
Member
Author
|
These are 2 cases I met in some apps where sorucemaps have Should supersede #58 |
Member
Author
|
Need review @stefanpenner @Turbo87 |
stefanpenner
requested changes
Apr 16, 2019
stefanpenner
requested changes
Apr 16, 2019
stefanpenner
approved these changes
Apr 16, 2019
Member
Author
|
As suggested by @stefanpenner I created 2 benchmarks comparing The result on my mac: So add another commit here to use |
Collaborator
|
released as v3.1.1 🎉 |
|
Just spent so long thinking I had configured something wrong trying to sort this out. And turns out a fix has been here all along :/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Case 1, sourcemap missing
In terser-js, sources are always 0 if old sourcemaps are not provided.
In
broccoli-uglify-sourcemapwe know in this case we are generating sourcemap for the file we are processing, changing 0 to the actual file gives us the correct source.Case 2, multiple sourceMap comments
source-map-urlonly matches the very first magic comment, that let us mistakenly thinks the js file doesn't have a valid sourcemap.Fix #130