Dynamic module promises in the exports
array is broken
#13733
Labels
needs triage
This issue has not been looked into
exports
array is broken
#13733
Is there an existing issue for this?
Current behavior
Since the commit be6d90a#diff-10d05a74883d097e0c5b94c8564bd68b26cfcc9c57b32e3e0c0024c9e91c3e88 (nestjs v6), the following is supposed to work but it doesn't:
it crashes with the following error:
we can easily see that this is either a missing feature or a regression.
Minimum reproduction code
https://gitlab.com/micalevisk/nestjs-issue-13733
Steps to reproduce
Expected behavior
I tested it with nestjs v6, v7 (with a different error), v8, v9, v10 so I'm pretty sure that this was never supported besides what the type definition says.
I found that after testing the
ConditionalModule
feature with dynamic modules returning promises. I never saw anyone reporting this error before so I'd say that this is not common pattern at all.I tried to fix this but due to the async nature I didn't managed to fix it easily.
So instead of starting supporting it now in v10, I'd rather prefer to drop the
Promise<DynamicModule>
type fromexports
in NestJS v11. Or just drop it now in v10 because it doesn't seem to be used anyway.If anyone starting asking for such fix in <=v10, we could suggest them to use
exports: [YourDynamicModule]
instead and tell them that this is not a feature but a wrong type definition.Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
10.3.9
Packages versions
N/A
Node.js version
No response
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: