Browserify - ParseError: 'import' and 'export' may appear only with 'sourceType: module

后端 未结 3 363
滥情空心
滥情空心 2021-01-17 15:22

In my gulpfile I have

var gulp = require(\'gulp\');
var browserSync = require(\'browser-sync\').create();
var sass = require(\'gulp-sass\');
var babel = requ         


        
3条回答
  •  -上瘾入骨i
    2021-01-17 15:51

    Simply switching to webpack instead of browserify fixed the issue for me.

    var webpack = require('webpack-stream')
    
    gulp.task('default', function () {
      return gulp.src('src/source.js')
        .pipe(webpack({
          output: {
            filename: 'app.js'
          }
        }))
        .pipe(gulp.dest('dist/app.js'))
    })
    

提交回复
热议问题