yapplabs/ember-tether

included hook?

RobbieTheWagner opened this issue · 8 comments

I believe the addition of an included hook in index.js should fix the issue of Tether not being defined when you use this in an addon, and there should be no need for it being a peerDependency. I have something like this in my setup, and it seems to pull the node assets into all my consuming apps and addons:

included: function(app) {
    this._super.included.apply(this, arguments);

    // see: https://github.com/ember-cli/ember-cli/issues/3718
    while (typeof app.import !== 'function' && app.app) {
      app = app.app;
    }

    this.app = app;

We dropped the peerDependency and adopted ember-cli-node-assets, obviating the need for this change.

@lukemelia when was this done? I thought it had always used ember-cli-node-assets, but it also, for some reason required the peerDep?

@rwwagner90 I think you are right. It may be that npm3 made this unnecessary. Are you finding that something else is necessary to use this in an addon?

@lukemelia not sure. I'll assume it works, since ember-cli-node-assets has always worked for me regardless of how many addons I nest in addons.

@lukemelia @rwwagner90 hey, I'm using ember-cli: 2.17.1 and I'm getting the error Tether is not defined. Looks like this is related to ember-cli-node-assets issue (https://github.com/dfreeman/ember-cli-node-assets/blame/master/README.md#L5). As a workaround I added manual app.import('node_modules/tether/dist/js/tether.js'); in ember-cli-build file.

@andrewfan are you in an app or addon?

@rwwagner90 in app, I did not install ember-tether directly it was installed as the dependency of https://github.com/sir-dunxalot/ember-tooltips, now I tried to install ember-tether directly and it worked.

@andrewfan yes, I do think it needs to be installed directly into the app, for some reason. I still have it in a blueprint for ember-shepherd to add it to the consuming project because it wouldn't work without it. https://github.com/shipshapecode/ember-shepherd/blob/master/blueprints/ember-shepherd/index.js#L7

@lukemelia any idea why this is required? Most addons, especially when using ember-cli-node-assets, seem to have usually worked out of the box, if just dropped in "dependencies" in package.json.