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
TLDR: Is there a tool to list Modules that were imported within a Module, but there is not a single Provider using any of the Exported Providers from that Module?
Over the years working on a project written in NestJS, I've refactored many of the providers, split some providers into smaller ones, extracted them to own modules, etc.
My IDE tells me when I have an unused variable/property and sometimes I clean them up, when I'm in the file. Rarely I remember to try and remove the module from the imports of the module though.
I.e. I've just noticed I no-longer use AccountsService in my CartsService. I removed accountsService from my constructor. The CartsService was the only place within CartsModule which depended on AccountsService, so I have safely removed AccountsModule from my imports.
As a side-effect, next time I eventually need to work with CartsModule from within AccountsModule, I possibly can, without introducing a cyclic import.
I'd like to check that there are no modules that have leftover imports which are not required. I'd guess there's no huge memory or performance impact of having them, but I'd feel better knowing I don't have them.
A simple CLI tool I'd run manually every now and then would suffice, I don't need to monitor that or have an online tool set up for that. But again, maybe such feature exists in NestJS Devtools?
Thanks in advance
While not thinking about a CLI, this could be implemented into the DebugModule (probably) as it will have everything already loaded into their maps and introspection can then be done. It'll also help out with #45 as we'll need to see what is and isn't used
The text was updated successfully, but these errors were encountered:
TLDR: Is there a tool to list Modules that were imported within a Module, but there is not a single Provider using any of the Exported Providers from that Module?
Over the years working on a project written in NestJS, I've refactored many of the providers, split some providers into smaller ones, extracted them to own modules, etc.
My IDE tells me when I have an unused variable/property and sometimes I clean them up, when I'm in the file. Rarely I remember to try and remove the module from the imports of the module though.
I.e. I've just noticed I no-longer use AccountsService in my CartsService. I removed accountsService from my constructor. The CartsService was the only place within CartsModule which depended on AccountsService, so I have safely removed AccountsModule from my imports.
As a side-effect, next time I eventually need to work with CartsModule from within AccountsModule, I possibly can, without introducing a cyclic import.
I'd like to check that there are no modules that have leftover imports which are not required. I'd guess there's no huge memory or performance impact of having them, but I'd feel better knowing I don't have them.
A simple CLI tool I'd run manually every now and then would suffice, I don't need to monitor that or have an online tool set up for that. But again, maybe such feature exists in NestJS Devtools?
Thanks in advance
While not thinking about a CLI, this could be implemented into the
DebugModule
(probably) as it will have everything already loaded into their maps and introspection can then be done. It'll also help out with #45 as we'll need to see what is and isn't usedThe text was updated successfully, but these errors were encountered: