Browserify Babelify Uglify source map sources do n

2019-07-11 12:44发布

I generated a js file with a source map using the following gulp task. The original sources get loaded in Firefox but do not get loaded in Chrome. Can anyone point out why Chrome can't find the sources which are clearly included in the generated index-[hash].js.map?

gulp.task('browserify', function () {
  // set up the browserify instance on a task basis
  return browserify({ debug: true })
    .transform(babelify)
    .require('client/web/private/js/es6/index.js', { 
      entry: true 
    })
    .bundle()
    .on('error', function handleError(err) {
      console.error(err.toString());
      this.emit('end');
    })
    .pipe(source('index.js'))
    .pipe(buffer())
    .pipe(sourcemaps.init({ 
      loadMaps: true 
    }))
      // Add transformation tasks to the pipeline here.
      .pipe(uglify())
      .pipe(rev())
    //   .on('error', gutil.log)
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('./client/web/public/dist/js'))
});

0条回答
登录 后发表回答