Skip to content
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

UglifyJS2 used by gulp-uglify generates source maps but mapping is incorrect #1329

Closed
dragonflypl opened this issue Oct 14, 2016 · 2 comments

Comments

@dragonflypl
Copy link

I have this task to generate bundled & minified JavaScript file:

    return gulp.src(paths)
        .pipe(paths.sortByFilename ? sorter(key) : gulpUtil.noop())
        .pipe(plumber(eh('Error compiling javascript (' + key + ')')))
        .pipe(sourcemaps.init())
        .pipe(gulpBabel())
        .pipe(gulpConcat(key + '.js'))
        .pipe(gulp.dest(cp.build(gomModule) + '/js'))
        .pipe(gulpNgAnnotate({add: true, single_quotes: true}))
        .pipe(gulpUglify())
        .pipe(gulpRename({ extname: '.min.js' }))
        .pipe(sourcemaps.write("."))
        .pipe(gulp.dest(cp.build(gomModule) + '/js'));   

Looks ok: .min.js gets mangled etc and sourcemaps are generated. But unfortunatelly debugging is not possible. Mapping is incorrect - stepping through the code / locals is broken. gulp-uglify seems to be the culprit because if I remove it from the the task, mapping works (with ngAnnotations in place as well as with babel transformation). Any idea that's going on? User versions are:

"gulp-sourcemaps": "^2.1.1",
"gulp-ng-annotate": "~2.0.0",
"gulp-babel": "^6.1.2",
"gulp-concat": "^2.6.0",
"gulp-uglify": "^2.0.0", // uses "uglify-js": "2.7.3",
"gulp-rename": "~1.2.0"
@rvanvelzen
Copy link
Collaborator

We are not gulp-uglify. Please report an issue with them.

@g5codyswartz
Copy link

g5codyswartz commented Nov 5, 2016

@dragonflypl Did you open a ticket with gulp-uglify? I'm trying to figure this same exact issue out right now and Google is bringing me to this ticket.

Edit: found your ticket for anyone else that needs to follow this: terinjokes/gulp-uglify#236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants