Does Ember support libraries which have dependencies on other libraries?

154 views Asked by At

I am trying to use a library called techan.js with Ember. It is dependent on d3.js.

In my Brocfile.js, I have:

app.import('bower_components/d3/d3.js'); app.import('bower_components/TechanJS/dist/techan.js');

However, when I run the app, there is an error because d3 is not defined when it is running techan.

When using an AMD library like Requirejs, you can define dependencies and get them to load in the right order. Does Ember have a similar capability?

1

There are 1 answers

4
artych On

Yes, ember supports libraries with dependencies. After all steps you did you just should declare d3 and tech as globals to avoid error you see.

//console
bower install --save andredumas/techan.js

//Brocfile.js
...
app.import('bower_components/d3/d3.js');
app.import('bower_components/TechanJS/dist/techan.js');
module.exports = app.toTree();

//.jshintrc
{
  "predef": [
    //...,
    "d3",
    "techan"
  ],
  // ...
}

//console
ember server