Instead of running $ node index.js to start the application, use $ node bootstrap.js. This will transform ES2015 module syntax into CommonJS module syntax on the fly.
See https://www.npmjs.com/package/es6-module-loader#nodejs-use
Instead of running $ node index.js to start the application, use $ node bootstrap.js. This will transform ES2015 module syntax into CommonJS module syntax on the fly.
See https://www.npmjs.com/package/es6-module-loader#nodejs-use
| var System = require('es6-module-loader').System; | |
| // System.transpiler = 'babel'; | |
| // System.transpiler = 'typescript'; | |
| System.import('./index').then(function (index) { | |
| index.run(__dirname); | |
| }).catch(function (error) { | |
| console.log('error', error); | |
| }); |
| export default class Cat { | |
| } |
| import Cat from './cat'; | |
| // use Cat... |
This is supposed to work, but
Systemhad trouble loading'babel'.