embroider-build / ember-auto-import

Zero config import from npm packages
Other
360 stars 108 forks source link

doc note for use in in-repo addons #174

Open oliverlangan opened 5 years ago

oliverlangan commented 5 years ago

This is more a word of advice than an error, possibly useful in the docs.

Our addon uses in-repo addons (yes, addons within addons—long story), and we import ember-auto-import in the top level package.json file. This works for the most part, except when building for production.

The solution is to make sure that ember-auto-import and the relevant libraries to be imported are also in the in-repo addon's package.json file, as dependencies per usual for use in an addon.

ef4 commented 5 years ago

Thanks, it sounds like there may be a legit bug here, in that we should fail consistently & early.

Clarifying question: when you say "except when building for production", is the issue that it only breaks with ember-cli's --environment=production, or is the issue that it breaks when your addon is used by an app?

oliverlangan commented 5 years ago

It is only broken when the app using the addon is built using --environment=production. If the app is built for development, it works.

A workaround is that the app can also use ember-auto-import and (in our case) loadash, and the library will be found as expected.

ef4 commented 5 years ago

Ok, so that is definitely concerning and we should figure out how to make it fail in development.