so I would expect to be able to access ServiceA inside ModuleB however that's not the case unless I explicitly declare ServiceA in the exports array of ModuleA
not totally sure if that is expected behavior or a bug, you decide
This is expected. Nest is all about encapsulation of the logic and will only expose the services in the exports array, as described in the documentation
my package json:
"@nestjs/common": "^7.0.0", "@nestjs/core": "^7.0.0", "@nestjs/jwt": "^7.1.0", "@nestjs/mongoose": "^7.0.2", "@nestjs/ng-universal": "^4.0.1", "@nestjs/passport": "^7.1.0", "@nestjs/platform-express": "^7.0.0",
I have the following scenario:
ModuleA({ providers: [ServiceA] })
ModuleB({ imports: [ModuleA] })
so I would expect to be able to access ServiceA inside ModuleB however that's not the case unless I explicitly declare ServiceA in the exports array of ModuleA
not totally sure if that is expected behavior or a bug, you decide
regards!