How can I generate valid source maps using Gulp, Uglify & Concat?

Has anyone found a working combination of Gulp, Uglify, and Concat that generates a valid source map? GitHub seems to have a lot of problems regarding these kinds of interactions, but people seem to have found combinations that work successfully. I tried many options, but the moment I turn on uglify, character matching does not work, and breakpoints do not work correctly in the browser. For example, the following works just fine:

return gulp.src('/scripts/*.js')
            .pipe(sourcemaps.init())
            //.pipe(uglify())
            .pipe(concat(outputName + '.min.js'))
            .pipe(sourcemaps.write('./'))
            .pipe(gulp.dest(outputPath))
            .on('end', function() { gutil.log('Minified ' + outputName); })
            .on('error', handleError);

but uncomment guesses, and it is not.

I created a GitHub repository to reproduce the problem: https://github.com/jamescrowley/gulpIssues

+4
source share
1

:

.pipe(sourcemaps.init()) .pipe(concat('app.js')) .pipe(ngAnnotate()) .pipe(uglify()) .pipe(sourcemaps.write()) .pipe(gulp.dest('app.js'))

, , . .

:

"browser-sync": "^2.2.4", "gulp": "^3.8.6", "gulp-concat": "^2.3.4", "gulp-ng-annotate": "^0.2.0", "gulp-rename": "^1.2.0", "gulp-replace": "^0.4.0", "gulp-sourcemaps": "^1.1.0", "gulp-uglify": "^0.3.1", "gulp-util": "^2.2.20"

0

All Articles