-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Uglify sourcemaps support #617
Conversation
DeMoorJasper
commented
Jan 22, 2018
•
edited
Loading
edited
- Sourcemap support for builds (supporting uglify)
- Added functions to search closest mapping for both original and generated mappings
- Tried to make it as fast as possible (Based on binary search) 🚀
Codecov Report
@@ Coverage Diff @@
## master #617 +/- ##
=========================================
- Coverage 91.98% 91.08% -0.9%
=========================================
Files 68 68
Lines 3404 3453 +49
=========================================
+ Hits 3131 3145 +14
- Misses 273 308 +35
Continue to review full report at Codecov.
|
src/transforms/uglify.js
Outdated
sourceMap: asset.options.sourceMaps | ||
? { | ||
filename: asset.relativeName | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think uglify has a way to pass an input source map to it so you don't have to manually map it like you did below. See https://github.com/mishoo/UglifyJS2#source-map-options. Looks like the content
option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen it but that would add an extra stringify (asset.sourcemap.toString()) and parse (on uglify's side) operation to the building of the new sourcemap, which is the largest performance problem with source-map 0.6.1
…/parcel into feature/uglify-sourcemaps
¿Any advance on this? Just asking 😝 |
@sant123 as far as i know it's ready to go, just waiting on the approval and merge from Devon |
…/parcel into feature/uglify-sourcemaps
…/parcel into feature/uglify-sourcemaps
@devongovett this should be ready to go |
src/transforms/uglify.js
Outdated
} | ||
} | ||
|
||
// Log all warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not log all of these. Uglify logs a lot of warnings and they are pretty much useless. I removed this in master already.
src/transforms/uglify.js
Outdated
if (result.error) { | ||
throw result.error; | ||
} | ||
|
||
if (result.map) { | ||
result.map = await new SourceMap().addMap(JSON.parse(result.map)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's possible to get the map without converting to JSON first. https://github.com/mishoo/UglifyJS2/blob/master/lib/sourcemap.js#L94
Might be faster - maybe you could even access the original mappings from there so you don't need to decode it.
Fix Rust wasm-gc test (#862)
…/parcel into feature/uglify-sourcemaps
Use raw mappings rather than generating and parsing the sourcemap from uglify.
Uglify Sourcemap improvements