Replies: 5 comments 4 replies
-
I got a similar problem with the IoC. I'm declaring a contract and trying to import it into a command file. // contracts/cron.ts
declare module '@ioc:Adonis/Addons/Cron' {
abstract class CronJob {
// ...
}
} import { CronJob } from '@ioc:Adonis/Addons/Cron' But I'm having the same output message as @milgner : IocLookupException: E_IOC_LOOKUP_FAILED: Cannot resolve "Adonis/Addons/Cron" namespace from the IoC Container |
Beta Was this translation helpful? Give feedback.
-
Could you both post more of your code? Remember that the items are not available from raw imports (since those imports happen when the file is read by node), but rather you have to use the appropriate To be more specific, make sure you're using the |
Beta Was this translation helpful? Give feedback.
-
Hey all of you! 👋 Could you please post some code of what you are doing? Also, take notes that if you are doing a Service Provider, this behavior is intended, you shouldn't rely on framework internals when building a service provider. |
Beta Was this translation helpful? Give feedback.
-
(I think) I finally figured this out fwiw: 1. No non-Core IOC access inside the
|
Beta Was this translation helpful? Give feedback.
-
Hi This works for me, resolving the service in the provider. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
So I started building a small application with Adonis.js and so far everything has been really nice!
There's one thing I can't seem to wrap my head around, though:
I have a service that provides a function to create a URL. I'm injecting it into a controller and a listener and everything works fine. Now however I started enhancing another service - which by itself can also be injected just fine - in a way that would also require it to use this URL-generation service.
As soon as I add the ioc-import (at the end of my imports), the application stops build and complains about
The Mail import is my second import, though, even before the newly-added import. Are there any recommendations / best practices for this kind of scenario? I think that using services from other services is not that uncommon?
Beta Was this translation helpful? Give feedback.
All reactions