I'm trying to import Underscore as a named module into my Ember CLI addon. Looking at the Standard AMD Asset section of the guides, it seems this should work:
app.import(app.bowerDirectory + '/underscore/underscore.js', {
exports: {
'underscore': ['default']
}
});
Here's the line from Underscore's source:
define('underscore', [], function() {
return _;
});
I tried to import it in one of my files, /addon/utils/class.js
:
import _ from 'underscore';
and got an error:
Could not find module
underscore
imported fromember-cli-mirage/utils/class
What'd I do wrong?
This is the problem:
if (typeof define === 'function' && define.amd)
define.amd
is not defined in ember-cli's loader.js.
Solutions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With