I'm using ES6 on Node through Babel. I can run ES6 scripts using a
run-babel script. So, this will work:
node run-babel build.js //build.js is written in ES6
But now I'd like to access one of these ES6 scripts from a Gulp task but Gulp runs on vanilla node.
Is there a way I can write Gulp tasks in ES6
You can first go into
node_modules/gulp/bin/gulp.js and edit the first line to become
#!/usr/bin/env node --harmony. This will invoke gulp in node harmony mode.
Then you can run
node_modules/gulp/bin/gulp.js build directly instead of
You can make an alias if you like :)
©2020 All rights reserved.