You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to...
I was trying to use typedi with monorepo, where we have a common repo where we place some common stuff between other repos, so there are common services there as well.
The problem:
If I create service in that common repo, decorate it with @service decorator, I still can't inject it anywhere else, it throws ServiceNotFoundError. If I place the same services inside my repo I'm trying to access this service in - everything works just fine. However now I need to duplicate all these services in all repos which is not optimal... Is there are way to share these services between repos in monorepo structure? Any ideas would really be helpful
The text was updated successfully, but these errors were encountered:
Of course, created a public repo, you can start it up with 2 make commands from readme file. If you go to service2/src/services/Authentication.ts you will see that I try to reach Cryptography service. If I use Cryptography service defined in the same project (in the same folder in this case as well) - it works as it should, however if I use that CryptographyService from service1 - it does not... https://github.com/Kimblis/typedi-monorepo-example
It seems to me that the node_modules resolution is a bit interesting in your repo. Because you have a node_modules folder for each app, the Service decorator gets resolved from their respective folders, resulting in multiple instances of Container.
In our nx monorepo, we have one shared node_modules folder so the resolution is fine.
I was trying to...
I was trying to use typedi with monorepo, where we have a common repo where we place some common stuff between other repos, so there are common services there as well.
The problem:
If I create service in that common repo, decorate it with @service decorator, I still can't inject it anywhere else, it throws ServiceNotFoundError. If I place the same services inside my repo I'm trying to access this service in - everything works just fine. However now I need to duplicate all these services in all repos which is not optimal... Is there are way to share these services between repos in monorepo structure? Any ideas would really be helpful
The text was updated successfully, but these errors were encountered: