nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
66.91k stars 7.55k forks source link

ConfigurableModuleClass registerAsync wrongly generates empty imports #11097

Closed tbglazer closed 1 year ago

tbglazer commented 1 year ago

Is there an existing issue for this?

Current behavior

ConfigurableModuleClass super.registerAsync() generates empty imports:[] overriding any imports existing before.

Minimum reproduction code

no reproduction code

Steps to reproduce

No response

Expected behavior

Should not generate empty imports. As a workaround call ...super.registerAsync() before adding any imports (unlike the documentation)

Package

Other package

No response

NestJS version

9.3.6

Packages versions

Node.js version

No response

In which operating systems have you tested?

Other

No response

micalevisk commented 1 year ago

I didn't manage to reproduce this.

Please provide a minimum reproduction repository. You can start from this minimal project.

why reproductions are required

tbglazer commented 1 year ago

Hi, I made a minimal reproduction at : https://github.com/tbglazer/nestjs-dynamic-module-bug.git Clone it and start it : npm run start In the output you can see that the registerAsync as compared to register generates an empty imports that is not needed and overrides any imports defined before. As a workaround you can spread the super.registerAsync() BEFORE any other code.

[image: image.png]

On Sat, Feb 11, 2023 at 4:57 PM Micael Levi L. Cavalcante < @.***> wrote:

I didn't manage to reproduce this.

Please provide a minimum reproduction repository. You can start from this minimal project https://stackblitz.com/edit/nestjs-issue-minimum-repro-starter?devtoolsheight=33 . why reproductions are required https://antfu.me/posts/why-reproductions-are-required

— Reply to this email directly, view it on GitHub https://github.com/nestjs/nest/issues/11097#issuecomment-1426792094, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANFZEGP3S4YPSVQYGZJ4OD3WW6SDXANCNFSM6AAAAAAUYUROOQ . You are receiving this because you authored the thread.Message ID: @.***>

kamilmysliwiec commented 1 year ago

This is the expected behavior.

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.