EmberSherpa / ember-cli-velocity

EmberCLI Addon wrapper for Velocity.js
MIT License
10 stars 11 forks source link

app.import when ember-cli-velocity is a third level addon #13

Closed thewebspot closed 7 years ago

thewebspot commented 7 years ago

I have an addon(notifications) that requires an addon(buttons). Then the buttons addon requires ember-cli-velocity. When velocity is loading the index.js file it throws an error. It says that 'app.import' is not a function. From what I have read, it looks like that the import function is not available below the second level.

If I wrap the importing with a check to see if app.import is a function, it will work. I did have to make sure I installed the addons being imported in my package.json file. Has anyone else ran into this issue? Do I need to set something else up in my ember app?

taras commented 7 years ago

This is a common problem with Ember addons. Let me try something and you can let me know if it works for you.

taras commented 7 years ago

Actually, what I was going to try is already in place.

@runspired do you have any thoughts on this?

thewebspot commented 7 years ago

I am going to do a fresh install of ember and see what might be different with my app versus a fresh install

runspired commented 7 years ago

For addons of addons, and addons in engines we have to change this to traverse up this.parent looking for import: https://github.com/EmberSherpa/ember-cli-velocity/blob/master/index.js#L31-L33

although this may work these days: https://github.com/runspired/ember-run-raf/blob/master/index.js#L8-L12

thewebspot commented 7 years ago

It looks like it is related to the way ember loads addons before ember 2.7.0. I created a new ember app and installed the addon that has the addon that has velocity and it was able to start just fine. I then upgraded the version of ember in my app from 2.6.3 to 2.8.0 and it is able to start just fine. Looks like they fixed whatever the issue was.

Thank you for responding so quickly.

thewebspot commented 7 years ago

I will keep testing making sure that upgrading ember solved the problem

thewebspot commented 7 years ago

This issue has not come up again.