UMD with Ember-CLI

I am trying to load gridstack in my Ember application via ember-cli. I installed the application through bower and imported it into the ember-cli-build.js . It includes _ as a library through:

 if (typeof define === 'function' && define.amd) { define(['jquery', 'lodash'], factory); } 

define.amd evaulates to false

I looked at why this was the case and found that the ember-cli bootloader does not support UMD . At the opening of the cli issue, Stefan Penner, one of the main developers of cli, suggested:

This is by design. Because this library requires a pre-build step to de-anonymize the modules. This step can make the appropriate work properly.

I have no idea what that means. I circumvented the problem by manually importing the dependencies of this library in my own ember-cli-build in front of this library, but this defeats the goal of dependency management. How can I make this library allow native modules?

+4
source share
1 answer

The current Ember-Kli versions not only support Standard Named AMD Asset via app.import('path/to/entry-point.js') as well as Standard Anonymous AMD Asset :

 app.import('path/to/entry-point.js', { using: [ { transformation: 'amd', as: 'your-named-import' } ] }); 

As usual, this is included in your ember-cli-build.js .

Sidenode: CommonJS modules can be loaded via ember-browserify .

0
source

All Articles