Browserify Babelify Uglify source map sources do not get loaded in Google Chrome

亡梦爱人 提交于 2019-12-12 17:17:59

问题


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'))
});

来源:https://stackoverflow.com/questions/33160787/browserify-babelify-uglify-source-map-sources-do-not-get-loaded-in-google-chrome

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