Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find peerDependency (miragejs) with importSync #1091

Closed
jrjohnson opened this issue Jan 30, 2022 · 2 comments
Closed

Cannot find peerDependency (miragejs) with importSync #1091

jrjohnson opened this issue Jan 30, 2022 · 2 comments

Comments

@jrjohnson
Copy link
Contributor

Getting the error Could not find module miragejs imported from (require) with miragejs in the devDependencies as well as peerDependencies. I created a reproduction and you can see the error at https://github.com/jrjohnson/test-miragejs-import/runs/4962685303?check_suite_focus=true#step:6:19 this is a new addon with miragejs installed and then used like:

if (macroCondition(dependencySatisfies('miragejs', '*'))) {
  const { Response } = importSync('miragejs');
  console.log(Response);
}

Not sure if I'm using this wrong or there is an issue with this specific import.

@Windvis
Copy link
Collaborator

Windvis commented Jan 31, 2022

You need to install ember-auto-import as a dependency when you import npm packages in addon code. After doing that (and returning Response from the util,) the test doesn't seem to fail anymore (at least for me locally).

@jrjohnson
Copy link
Contributor Author

Thank you so much @Windvis! Really really appreciate the help here. It seems maybe intuitive, but I would never have tried that assuming that importSync would bring it's own stuff and not rely on EAI. You've gotten me through a very frustrating situation and I can't thank you enough. I'm going to touch up the docs if I have a moment, but go ahead and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants