我有一个用esul文件编写的主项目:
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var watchify = require('watchify');
var browserify = require('browserify');
var streamify = require('gulp-streamify');
var sources = ['./src/main.js'];
var destination = '../../public/compiled';
var standalone = 'Round';
gulp.task('dev', function() {
return browserify('./src/main.js', {
standalone: standalone
}).transform('babelify',
{ presets: ["es2015"],
plugins: ['add-module-exports'] })
.bundle()
.pipe(source('round.js'))
.pipe(gulp.dest(destination));
});
我在package.json
中有这个本地依赖{
"dependencies": {
"game": "file:///home/ubuntu/ui/game",
},
}
game
模块用es6编写。我希望我的主项目在es6中安装和导入该模块并进行转换。但我得到了error:
'import' and 'export' may appear only with 'sourceType: module' #103