I've just thought that microservice is only required if you use microservices... Why core
depends on microservice
?
There are a couple of places where there are circular dependency issues that need to be sorted out.
Also the websockets module is a peer dependency and the app could not be started w/o them, even though the project doesn't use any of them.
As a general design idea, I think @nestjs/common
should be eliminated, and here's why:
Everything inside of each package should only depend on Core. By putting interfaces and the like in Common, every package has two dependencies that could have been just one. This isn't a problem, just a quirk for developers who need to remember where something was located: Core or Common.
To that end, Core should not depend on any other Nest package, because that could lead to circular dependency issues down the line. Core should be architected in such a way, where Microservices and Sockets are independent modules that individually extend on Core. Here's an example:
NestFactory.implement(MicroserviceFactory)
or something along those lines. That way, anyone can develop adapters simliar to sockets or microservices, and they can all easily be plugged into Core. And, of course, Core won't have to depend on @nestjs/microservices or @nestjs/websockets
@saskodh this could be causing some of the issues:
https://github.com/nestjs/nest/blob/dc7869b38f3cdc293028e4cca69623be8446efc3/src/core/nest-application.ts#L36-L41
By having this method on the Application instantiator, it has no choice but to depend. My alternative would be to put those methods in the respective packages.
Update: I鈥檓 working on a PR to eliminate this circular dependency
I've opened #212 to address circular dependency. Looking for reviewers and commits to turn CI green!
After latest release the codependency between packages is removed - it's possible to use core
without both microservices
and websockets
package installed. The dependencies have been eliminated without any breaking changes 馃檪
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
After latest release the codependency between packages is removed - it's possible to use
core
without bothmicroservices
andwebsockets
package installed. The dependencies have been eliminated without any breaking changes 馃檪