简体   繁体   English

gulp.js子任务编译错误的js

[英]gulp.js sub task compiling bad js

front end developer is on holidays and I need to make a few changes quickly. 前端开发人员正在休假,我需要快速进行一些更改。

I am running a gulp subtask to merge js files into a single app.js. 我正在运行一个gulp子任务,将js文件合并到单个app.js中。 When I run this subtask just to watch for changes it compiles a new app.js file that is completely different from the server file even though I did not make any changes. 当我运行此子任务只是为了观察更改时,即使没有进行任何更改,它也会编译一个与服务器文件完全不同的新app.js文件。 The website does not load if I run this subtask even with no changes. 如果我运行此子任务,即使没有更改,也不会加载网站。

I get an error 我得到一个错误

TypeError: selector cannot be an empty string

Here is the gulp task: 这是gulp任务:

gulp.task('js', function() {
    livereload.listen();
    bundle();
}); // so you can run `gulp js` to build the file
b.on('update', bundle); // on any dep update, runs the bundler
b.on('log', gutil.log); // output build logs to terminal

function bundle() {
    return b.bundle()
      // log errors if they happen
      .on('error', gutil.log.bind(gutil, 'Browserify Error'))
      .pipe(source('app.js'))
      .pipe(gulp.dest('./dist'))
      .pipe(livereload());

Time is running out. 时间不多了。 Any help would be appreciated. 任何帮助,将不胜感激。

我在vs中使用TaskRunner,它是为命令行设置的。

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

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