Skip to content

Issue with a missing module when using a v2 addon (that re-exports to the app namespace) in a broccoli ember-app #681

@iarroyo

Description

@iarroyo

Hi there, we are migrating our addon from version 1 to version 2. During this migration process, we have noticed the following scenario:

Image

This seems to happen because when

Then your helper/modifier/service is not discoverable from your addon code

We have identified two potential workarounds:

  1. Rename the conflicting helper/modifier/service in your app: For example:

    • Change app/modifiers/autofocus.js to app/modifiers/app-autofocus.js.

    While this solution works, it is somewhat inconvenient.

  2. 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
Image 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
Image 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!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions