ES6 Modules via Babel


#1

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: https://hyperdev.com/#!/project/pattern-ferret

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


#2

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


#3

Another working example, thanks to @johntron:

http://support.hyperdev.com/t/es2015-base-project-server-and-browser/428/1