如何解决源地图未在 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();
}
////
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。