how to debug gulp-sourcemaps not doing anything?

梦想与她 提交于 2019-12-10 14:47:52

问题


I have a fairly standard use case for gulp-sourcemaps

https://github.com/floridoo/gulp-sourcemaps

  gulp.src( bundle.src)
           .pipe(sourcemaps.init())
           .pipe(concat(bundle.dst + '.' + opts.ext))
            .pipe(uglify())
            .pipe(sourcemaps.write())
            .pipe(gulp.dest('./public/built'));

This produces appropriately concatenated and uglyified files. However there are no source map additions to them. bundle.src is an array of file paths. Not sure how to debug this.


回答1:


You should look into gulp-util. It may give you some insight into what is actually happening.

var gutil = require('gulp-util')
...
.pipe(sourcemaps.init().on('error', gutil.log))



回答2:


I had to specify where to write, like so:

.pipe(sourcemaps.write('./').on('error', gutil.log))

This didn't work: (no .map files generated)

.pipe(sourcemaps.write().on('error', gutil.log)


来源:https://stackoverflow.com/questions/26110830/how-to-debug-gulp-sourcemaps-not-doing-anything

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!