Open cmwd opened 9 years ago
I agree it would be nice if it would "just work" out of the box, but in the meantime I found a workaround using the nodeCmd option to use babel-node:
return gulp.src(path.resolve(__dirname, '../other-project/gulpfile.babel.js'))
.pipe(chug({
// Specify babel-node for ES6 support
nodeCmd: path.resolve(__dirname, 'node_modules/.bin/babel-node.cmd')
}))
.on('error', gutil.log);
The .cmd after babel-node is needed on Windows, but you'd want to drop that on any other OS. If you don't have babel-node installed,
npm i --save-dev babel-cli
should pull it down.
I came across this issue today and @03eltond workaround did work but it shouldn't be needed. I already have a .babelrc in the directory with the gulp file. I ended up just spawning my own process and it actually worked better and faster than this plugin.
import { exec } from 'child_process';
import map from 'map-stream';
function buildModules() {
return gulp.src(['./modules/*/gulpfile.babel.js'])
.pipe(map(function (file, cb) {
exec('gulp --gulpfile ' + file.path, function(error, stdout, stderr) {
console.log(stdout);
cb();
});
}));
}
buildModules.displayName = 'build';
gulp.task(buildModules);
May help someone else
Huh that's clever, thanks for sharing
Gulp since version 3.9 supports gulpfile written in es6 (babel). It would be great if gulp-chug could support babel. Right now I getting syntax error. Update dependency to new version of gulp didn't help.