2

我使用以下 gulp 任务生成了一个带有源映射的 js 文件。原始资源会在 Firefox 中加载,但不会在 Chrome 中加载。谁能指出为什么 Chrome 找不到明确包含在生成的 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'))
});
4

0 回答 0