我有gulpfile.babel.js:
function javascript() {
return gulp.src(PATHS.javascript)
.pipe($.sourcemaps.init())
.pipe($.babel())
.pipe($.concat('app.js'))
.pipe($.if(PRODUCTION, $.uglify()
.on('error', e => { console.log(e); })
))
.pipe($.if(!PRODUCTION, $.sourcemaps.write()))
.pipe(gulp.dest(PATHS.dist + '/assets/js'));
}
的Config.xml
PATHS:
# Paths to JavaScript libraries, which are compined into one file
javascript:
- "node_modules/gsap/src/uncompressed/TweenMax.js"
- "bower_components/scrollmagic/scrollmagic/uncompressed/ScrollMagic.js"
我需要这样做: - 1 Answer of Stackoverflow
使用Babel 6和babel-preset-es2015(或Babel 5)时,Babel默认假定它处理的文件是ES6模块。引起麻烦的是,在ES6模块中,这是未定义的,而在“脚本”情况下,这取决于环境,例如浏览器脚本中的窗口或CommonJS代码中的导出。