Open anehx opened 1 year ago
I believe this is an ember-auto-import issue. The error is thrown here.
dependencySatisfies does return false
correctly but I think ember-auto-import simply analyzes all imports and doesn't check for optional peerDependencies yet. I'm not familiar enough with the code (and intended workings) to know what the correct solution is but this is at least a first pointer for the real issue 😄.
We just fixed a very similar case in https://github.com/ef4/ember-auto-import/pull/530 by moving an error from build time to runtime.
It would make sense to do the same for importSync
for the same reason.
Hi
I'm having problems with the
dependencySatisfies
macro. I have an addon that defines a peer dependency as optional. The addon code then usesdependencySatisfies
to check whether I need to implement a function (including an import of that dependency).However, if I use that addon in an app that does not have that dependency, the macro still resolves to
true
which causes an error ofember-auto-import
:@apollo/client
is not present in the dependencies, I verfied that withyarn why @apollo/client
.Here are the relevant code snippets of the addon:
Could you take a look at that? Let me know if I can do something to help..