-
Notifications
You must be signed in to change notification settings - Fork 109
Description
Hi there, we are migrating our addon from version 1 to version 2. During this migration process, we have noticed the following scenario:
This seems to happen because when
- Your v2 addon has a component that direct import a helper/modifier/service
- Those are re-exported to the app namespace
- Your app has the same helper/modifier/service name
Then your helper/modifier/service is not discoverable from your addon code
We have identified two potential workarounds:
-
Rename the conflicting helper/modifier/service in your app: For example:
- Change
app/modifiers/autofocus.jstoapp/modifiers/app-autofocus.js.
While this solution works, it is somewhat inconvenient.
- Change
-
Use relative Imports in the V2 Addon: Instead of importing by package name, use relative paths.
This solution resolves the issue, but it requires significant changes to the import statements on our end.
On the other hand, to add more details, here you have the following outputs
- Renaming the autofocus modifier to app-aoutofocus so there is no naming collision
In this 1st scenario, the "./node_modules/@iarroyo/ember-addon-appreexports/dist/modifiers/autofocus.js" exists
- Having the same name for the autofocus modifier in the addon and app
In this 2nd scenario, the "./node_modules/@iarroyo/ember-addon-appreexports/dist/modifiers/autofocus.js" does NOT exist
Repro
https://github.com/iarroyo/ember-addon-appreexports (addon)
https://github.com/iarroyo/ember-app-appreexports (app)
Note: I believe the issue is related to ember-auto-import. If this issue is unrelated or a duplicate, please let me know how to proceed.
Thank you!!