U
U
Username2021-03-23 07:28:00
JavaScript
Username, 2021-03-23 07:28:00

How to make a module independent in NextJS?

Good afternoon!

Often in a project you have to use the services of one module in another module, but due to the fact that the service is crammed with other services, a database repository, a third-party service, there is a problem when importing such a service into another module, the module does not know about other services and you need to copy-paste code from a native module and insert them into another module.

How I want to do it: so that when importing a service into another module, I do not need to import all the dependencies of this service, they are, as it were, pulled up from the module of this service.
How can I do that?

Error: Nest can't resolve dependencies of the MyService (?). Please make sure that the argument SecondService at index [0] is available in the MyModule context.

Potential solutions:
- If SecondService is a provider, is it part of the current MyModule?
- If SecondService is exported from a separate @Module, is that module imported within MyModule?
  @Module({
    imports: [ /* the Module containing SecondService */ ]
  })

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question