ES6 Modules via Babel


It seems that sticking "babel": { } in package.json suffices to be able to use fancy arrow syntax for functions and whatnot but it doesn’t work for import and export es6 style.

(Actually I think "babel": { } was a red herring and some es6 syntax is just supported out of the box with Node.)

So I’m wondering if anyone has an example of doing es6 modules?

Here’s me flailing around cluelessly trying to set the right dependencies and start script to make Babel work:!/project/pattern-ferret

UPDATE: To see which es6 (aka es2015) features are supported directly in Node, see As of 2016-05-25, HyperDev runs Node.js version 4.4.3.


I’ve got it working. Have to use babel-register:


Another working example, thanks to @johntron: