mardi 15 septembre 2015

ES6 lib with named exports in ./vendor dir

Ember 2.0 / ember-cli 1.13.8

I couldn't find a way to import names export from ES6 module located in ./vendor dir in my Ember 2.0 project.

  • simple import {Socket} from 'vendor/phoenix' in my Controller does not transpile the lib into ES5

  • app.import('vendor/phoenix.js', {exports: {phoenix: ['Socket']}}) in my ember-cli-build.js does not transpile the lib into ES5 either.

  • I have also tried http://ift.tt/1KktgVW --
    1. could not make it work due to named exports. (Error: Entry module can only have named exports in strict mode (pass ``strict: true``)
    2. When I just modify the library to use default export the error went away but the library was not available for import. Looks like Broccoli didn't merge the lib into the tree.

here is my ember-cli-build.js :

  var tree = './vendor';
  var amdFiles = new ES6Modules(tree, {
    format: 'amd',
    bundleOptions: {
      entry: 'phoenix.js',
      name: 'phoenix'
    }
  });

  return mergeTrees([app.toTree(), amdFiles]);




Aucun commentaire:

Enregistrer un commentaire