Debugging variables not working with sourcemaps + uglify
See original GitHub issueI have the following gulp task for bundling javascript:
gulp.task('js', function () {
return gulp.src(paths.js)
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('bundle.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('dist'));
});
When I run this in the Chrome dev tools, sourcemaps are found and breakpoints work, but variables can’t be debugged.
Take this example chunk of angular code:
iarApp.config(['$animateProvider', function ($animateProvider) {
$animateProvider.classNameFilter(/angular-animate/);
}]);
If I add a breakpoint to see the value of $animateProvider
, I get the following:
But if I turn off variable mangling in Uglify:
.pipe(uglify({ mangle: false }))
Then it works:
So it seems that the gulp-sourcemaps plugin can’t follow up variables after Uglify mangles the names.
Can anyone else get the same issue and/or know a solution?
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Debugging variables not working with gulp sourcemaps + uglify
When I run this in the Chrome dev tools, sourcemaps are found and breakpoints work, but variables can't be debugged. Take this example...
Read more >Debugging variables not working with sourcemaps + uglify
I have the following gulp task for bundling javascript: gulp.task('js', function () { return gulp.src(paths.js) .pipe(sourcemaps.init()) .pipe(uglify()) ...
Read more >4 Reasons Why Your Source Maps are Broken - Sentry Blog
Here are four reasons why your source maps are broken and tips on how ... Debugging Minified JavaScript with Source Maps, before continuing....
Read more >Javascript Debugging Made Easier with Sourcemaps
Sourcemaps bacically are a way to map the combined/minified file back to the original file.
Read more >UglifyJS 3 - JavaScript on Fiber - FIBJS
uglify -js@3 has a simplified API and CLI that is not backwards compatible with ... `content` Input source map, useful if you're compressing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fernandoneira I have just tried your workaround
{ mangle: false }
and works fine. Thanks man!This is a sourcemap problem, not a gulp-sourcemaps issue.