➜ koa-demo runkoa index.js
index.js
/Users/sang/workspace/17koa/koa-demo/node_modules/babel-polyfill/lib/index.js:14
throw new Error("only one instance of babel-polyfill is allowed");
^
Error: only one instance of babel-polyfill is allowed
at Object.<anonymous> (/Users/sang/workspace/17koa/koa-demo/node_modules/babel-polyfill/lib/index.js:14:9)
at Module._compile (module.js:434:26)
at Module._extensions..js (module.js:452:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/sang/workspace/github/runkoa/node_modules/babel-register/lib/node.js:134:7)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (index.js:3:1)
at Module._compile (module.js:434:26)
➜ koa-demo cat index.js
'use strict';
require("babel-polyfill");
// set babel in entry file
require('babel-core/register')({
presets: ['es2015-node5', 'stage-3']
});
require('./app'); // this is es7 - gets transpiled