简体   繁体   English

抛出浏览器的同名多个源图? (吞掉-sourcemaps)

[英]multiple sourcemaps with the same name throwing off browser? (gulp-sourcemaps)

Here is the gulpfile: 这是gulpfile:

widgets.forEach(function(widget){
        gulp.src('widgets/' + widget + "/Widget.es6")
            .pipe(sourcemaps.init())
            .pipe(babel({ modules: 'amd' }))
            //.pipe(uglify())
            .pipe(rename('Widget.js'))
            .pipe(sourcemaps.write('.'))
            .pipe(gulp.dest('widgets/' + widget + "/"));
    });

I have several "widgets" which I need to process. 我有几个“小部件”,我需要处理。 Each needs its own sourcemap. 每个都需要自己的源图。 However, each widget has its own Widget.js file (inside its directory). 但是,每个小部件都有自己的Widget.js文件(在其目录中)。 This results in a Widget.js.map being created in each widget directory. 这导致在每个窗口小部件目录中创建Widget.js.map。 This would be fine except that when I open up the google chrome developer and try to debug the original file by clicking in the transpiled one it is getting mixed up. 这很好,除了当我打开谷歌浏览器开发人员并尝试通过点击已编译的原始文件来调试原始文件时,它正在混淆。 I think it is using the wrong sourcemap because they all have the same name. 我认为它使用了错误的源图,因为它们都具有相同的名称。

Looking for a solution to this problem (I need to name the widget js file Widget.js because of the framework I am working with) 寻找这个问题的解决方案(因为我正在使用的框架,我需要命名小部件js文件Widget.js)

Thanks in advance. 提前致谢。

Adding a base to gulp.src fixed this issue for me. gulp.src添加一个库为我解决了这个问题。

For example gulp.src('widgets/' + widget + '/Widget.es6', { base: './' }) 例如gulp.src('widgets/' + widget + '/Widget.es6', { base: './' })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM