源地图未在 Google Chrome 中激活

问题描述

我真的很难使用源映射。有任何想法吗 ?
这是上下文:

  • 堆栈:babel+gulp+browserify
  • 在我的文件底部添加了 Srouce 地图链接
  • 在 Chrome 中启用了源地图
  • Chrome 表示它检测到源地图。
  • 文件托管在 Shopify 上
  • 当我输入 Ctrl+P 时,我没有检测到源地图
  • 我尝试了多种手动添加源映射的变体,如 here 所示,但没有奏效。 (name.js.map | name.js.map?v=xxxxx | 完整网址等.)



gulpfile.js

//////
var sourcemaps = require('gulp-sourcemaps');
//////

////
function compilebrowserify(done) {
    var bundler = watchify(browserify(paths.scripts.target,{ debug: true })
        .transform(babel,{
                "plugins": ["@babel/plugin-proposal-class-properties","@babel/plugin-proposal-private-methods","@babel/plugin-transform-runtime",],"presets": ["@babel/preset-env"]
            })
    );

    function rebundle() {
        bundler.bundle()
            .on('error',function (err) { console.error(err); this.emit('end'); })
            .pipe(source('sz_xxxx.js'))
            .pipe(buffer())
            .pipe(sourcemaps.init({ loadMaps: true }))
            .pipe(sourcemaps.write('./'))
            .pipe(header(banner.main,{ package: package }))
            .pipe(touch())
            .pipe(dest(paths.scripts.output));
    }

    bundler.on('update',function () {
        console.log('-> bundling...');
        rebundle();
    })

    rebundle();
    done();
}
////

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)