ember-cli / ember-compatibility-helpers

Helpers that allow you to write backwards compat Ember addons
MIT License
24 stars 20 forks source link

bugfix(build): Fixes the case where the addon has been included more than once #8

Closed pzuraq closed 6 years ago

pzuraq commented 6 years ago

The included hook only runs once per instance of the addon in the dependency graph. The babel transforms we are adding, however, are meant to be added to each addon that includes this addon as a dependency, as well as the root app. Because each addon has it's own version of ember-cli-babel, we have to make sure it happens for each of them.

To do this, we use the init hook instead of the included hook, since it runs each time the addon is created. Unfortunately, the init hook does not have any way to access the root app - that is only provided in the included hook. So, we still need to use included for the case where this addon is being used in an actual app.