spencer516 / ember-d3-scale

Ember D3 Scale Helpers
MIT License
2 stars 1 forks source link

`app.import is not a function` unless `included` is defined in addon `index.js` #6

Open ghost opened 8 years ago

ghost commented 8 years ago

I was using D3v3 in an addon I am working on, and then switched to your library. I then started seeing this error when I start the addon's nodejs server:

TypeError: app.import is not a function
    at /Users/zz/development/ember-sparkles/node_modules/ember-d3-scale/node_modules/ember-cli-d3-shape/index.js:50:17

I discovered that the following minimal amount of code in my addon's index.js provides a workaround:

module.exports = {
  included: function() {
  }
  // etc
}

It would appear that this might be related to something you fixed earlier, here: https://github.com/ivanvanderbyl/ember-cli-d3-shape/pull/7

spencer516 commented 8 years ago

That's weird. I'm not quite sure what the implications are of using an addon for an addon that also depends on another addon. (This is the third layer now, right?)

Just perusing through the Ember-cli docs, it shows this — I didn't realize that included had a second argument:

module.exports = {
  name: 'ember-cli-x-button',
  included: function(app, parentAddon) {
    var target = (parentAddon || app);
    // Now you can modify the app / parentAddon.
  }
};

So, I'm not sure wether that means that the ember-d3-scale addon needs to handle this — or if ember-cli-d3-shape needs to. I can look into this later; but in the meantime, if you want to try seeing if changing the index file in ember-cli-d3-shape to use something like that instead might work?

ghost commented 8 years ago

@spencer516 thanks... yeah, insert xzibit addon meme here. I tried adding that logic to the index.js for ember-cli-d3-shape, no luck, but I may have been doing something wrong. I'm not blocked by this, however - the above mentioned workaround seems to be fine for now.

taras commented 8 years ago

@spencer516 @ivanvanderbyl we tried to figure this out but we couldn't get it to work. Would you guys mind jumping onto a call with us and try to figure this out? We can also show you what progress we made since the last time that we spoke.

ivanvanderbyl commented 8 years ago

@taras for sure. I've just been travelling the last 2 weeks, finally back with an internet. When would you like to tee up a call? @spencer516

taras commented 8 years ago

Spencer is coming back on Wednesday. Maybe set something up for Friday?

ivanvanderbyl commented 8 years ago

That works for me. I'm now on CET (Berlin) time.

taras commented 8 years ago

It'll likely need to be late in the evening for you because @spencer516 is on PST.

ivanvanderbyl commented 8 years ago

No worries

ghost commented 8 years ago

@spencer516 @ivanvanderbyl @taras I can do Friday, am pretty flexible regarding the time. Thanks everyone!

ivanvanderbyl commented 8 years ago

I can do Friday evening between 5pm and 8pm CET (GMT+2). Which is 8a to 11am PST. Let me know what works.

taras commented 8 years ago

Ok, let's do 9:00am PST which is 6pm for Ivan and noon for me. I'll send a meeting invite to everyone.