Can I run a Gulp task written in ES6 using Node?

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 gulp build.

You can make an alias if you like :)


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.