Core: Babel issue with controllers

Created on 11 Jan 2017  路  3Comments  路  Source: adonisjs/core

Running Adonis through Babel, everything works fine apart from the controller mapping mechanism.

Works fine

Route.get('version', function * (request, response) {
  response.send('okay')
})

Doesn't like the export

Route.get('version', 'UtilsController.version')
export default class UtilsController {
  * version (request, response) {
    response.send('okay')
  }
}

Is this an issue with the way adonis-fold does dependancy injection?

All 3 comments

Dear @milosdakic !

Adonis does not support any transpiler like Babel nor TypeScript.

Babel 6.0 transpile export default with module.export.default = {} this is probably why it is not working.

You may try to use this Babel plugin babel-plugin-add-module-export.

Yup that is the reason. Also I believe using babel is redudant ( in my view ). Node.js latest versions are almost compatible with ES6 specs

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

themodernpk picture themodernpk  路  3Comments

blendsoft picture blendsoft  路  3Comments

Extarys picture Extarys  路  4Comments

douglaszaltron picture douglaszaltron  路  3Comments

seanc picture seanc  路  4Comments