krislefeber / nestjs-dataloader

Dataloader plugin for NestJS
https://krislefeber.github.io/nestjs-dataloader/
MIT License
148 stars 45 forks source link

chore!: support for nest@10 #63

Open paopaojr opened 9 months ago

paopaojr commented 9 months ago

Overview

Problem

When we use nestjs@10 with nestjs-dataloader@9. It works fine on local development as it installs all dev dependencies. But when we do production prune package, nestjs app throws error on starting up.

$ yarn build # nest build
$ npm prune --production
$ node ./dist/main.js 

...
[APP] Error 1/17/2024, 11:26:07 AM [ExceptionHandler] Nest can't resolve dependencies of the DataLoaderInterceptor (?). Please make sure that the argument ModuleRef at index [0] is available in the ProductModule context.

Potential solutions:
- Is ProductModule a valid NestJS module?
- If ModuleRef is a provider, is it part of the current ProductModule?
- If ModuleRef is exported from a separate @Module, is that module imported within ProductModule?
  @Module({
    imports: [ /* the Module containing ModuleRef */ ]
  })
 - {
  stack: [
    "Error: Nest can't resolve dependencies of the DataLoaderInterceptor (?). Please make sure that the argument ModuleRef at index [0] is available in the ProductModule context.\n" +
      '\n' +
      ....
  ]
paopaojr commented 9 months ago

@krislefeber can you please review this PR and merge, and release the newer version?