-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fix sources: ["0"], output the correct source #140
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.
These are 2 cases I met in some apps where sorucemaps have Should supersede #58 |
Need review @stefanpenner @Turbo87 |
As suggested by @stefanpenner I created 2 benchmarks comparing The result on my mac:
So add another commit here to use |
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 :/ |
Case 1, sourcemap missing
In terser-js, sources are always 0 if old sourcemaps are not provided.
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.Case 2, multiple sourceMap comments
source-map-url
only matches the very first magic comment, that let us mistakenly thinks the js file doesn't have a valid sourcemap.Fix #130