title: SyntaxError: Unexpected token using async and babel in koa
body: <p>I have this simple app made using the last alpha version of Koa. In order to use `async/wait Babel.Js is required.</p>
  
  <pre><code>'use strict';
  
  // babel registration (runtime transpilation for node)
  require('./server.babel');
  
  const Koa = require('koa');
  const app = new Koa();
  
  // define logger - this will be always executed
  const logger = async (context, next) =&gt; {
    const start = new Date;
    await next();
    const ms = new Date - start;
    console.log(`${context.method} ${context.url} - ${ms}ms`);
  }
  
  const index = (context) =&gt; {
    context.body = 'Hello World';
  }
  
  app.use(logger);
  app.use(index);
  
  app.listen(3000);
  console.info(`The app is listening on port 3000`);
  </code></pre>
  
  <hr>
  
  <p>This is the hook to activate the transpiling.</p>
  
  <pre><code>const fs = require('fs');
  
  let config;
  
  try {
    config = JSON.parse(fs.readFileSync('./.babelrc'));
  } catch (error) {
    console.error('==&gt;  ERROR: Error parsing your .babelrc.');
    console.error(error);
  }
  
  require('babel-core/register')(config);
  </code></pre>
  
  <p>and this is the config file:</p>
  
  <pre><code>{
    "plugins": ["transform-async-to-generator"]
  }
  </code></pre>
  
  <p>Unfortunately when I try to run the project I get the following error:</p>
  
  <pre><code>const logger = async (context, next) =&gt; {
                   ^
  
  SyntaxError: Unexpected token (
      at exports.runInThisContext (vm.js:53:16)
      at Module._compile (module.js:404:25)
      at Object.Module._extensions..js (module.js:432:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:313:12)
      at Function.Module.runMain (module.js:457:10)
      at startup (node.js:138:18)
      at node.js:974:3
  </code></pre>
  
  <p>I have no idea why I get this error. I'm using the last Node.Js version <code>5.1.0</code> and Babel <code>6.2.1</code></p>