Webpack 我的吞咽文件赢了';无法读取任何更改,但它运行时没有问题

Webpack 我的吞咽文件赢了';无法读取任何更改,但它运行时没有问题,webpack,sass,gulp,Webpack,Sass,Gulp,问题是,当我开始编写新的SCS/css时,它不会像预期的那样关注更改。不 当然,我错在哪里了。我的文件是否被错误地监视,或者根本没有被监视。当我运行gulp时,一切运行正常,但当文件更改时,它不会自动更改 [16:21:41] Using gulpfile ~\Documents\DeMarcusW\starterkit\gulpfile.js [16:21:41] Starting 'default'... [16:21:41] Starting 'sass'... [16:21

问题是,当我开始编写新的SCS/css时,它不会像预期的那样关注更改。不 当然,我错在哪里了。我的文件是否被错误地监视,或者根本没有被监视。当我运行gulp时,一切运行正常,但当文件更改时,它不会自动更改

 [16:21:41] Using gulpfile ~\Documents\DeMarcusW\starterkit\gulpfile.js
 [16:21:41] Starting 'default'...
 [16:21:41] Starting 'sass'...   
 [16:21:45] Finished 'sass' after 3.47 s
 [16:21:45] Starting 'webpack'...       
 [16:22:18] Version: webpack 4.42.0
 Built at: 03/14/2020 4:22:18 PM
        Asset      Size     Chunks             Chunk Names
 firstComp.js  3.87 KiB  firstComp  [emitted]  firstComp
    vendor.js  80.5 KiB     vendor  [emitted]  vendor
 Entrypoint firstComp = firstComp.js
 Entrypoint vendor = vendor.js
 [16:22:18] Finished 'webpack' after 34 s
 [16:22:18] Starting 'browser-sync'...
 [Browsersync] Access URLs:
  -------------------------------------
        Local: http://localhost:3000
     External: http://192.168.1.11:3000
  -------------------------------------
           UI: http://localhost:3001
  UI External: http://localhost:3001
  -------------------------------------
 [Browsersync] Serving files from: ./public


这两条语句在gulp v4中不起作用(它们是v3风格的语法):

改为:

gulp.watch('./public/scss/**/*', 'sass')
gulp.watch('./public/js/**/*', 'webpack')
如果要运行多个任务

gulp.watch('./public/scss/**/*', gulp.series('sass', 'otherTask'));

此外,您也不能在以下内容的末尾执行
pipe
语句:

gulp.task( 'default', gulp.series('sass', 'webpack', 'browser-sync'), ()=>{
  gulp.watch('./public/scss/**/*', ['sass'])      // change as per above
  gulp.watch('./public/js/**/*', ['webpack'])     // change as per above
  .pipe(gulp.dest('./public/js'))                 // remove this
});
您还没有创建流,因此无法通过管道传输任何内容,只需删除该行即可。如果需要移动js文件,请在其他地方进行

gulp.watch('./public/scss/**/*', gulp.series('sass', 'otherTask'));
gulp.task( 'default', gulp.series('sass', 'webpack', 'browser-sync'), ()=>{
  gulp.watch('./public/scss/**/*', ['sass'])      // change as per above
  gulp.watch('./public/js/**/*', ['webpack'])     // change as per above
  .pipe(gulp.dest('./public/js'))                 // remove this
});