--disallow-code-generation-from-strings
breaks nest's named ESM exports
#10846
Labels
needs triage
This issue has not been looked into
Is there an existing issue for this?
Current behavior
If you run node with the
--disallow-code-generation-from-strings
option & use native ESM imports, some named ESM imports break.Minimum reproduction code
https://github.com/ephys/nest-esm-issue
Steps to reproduce
npm ci
node index.mjs
# should run without issuesnode --disallow-code-generation-from-strings index.mjs
# should break: named import not foundExpected behavior
For named exports to be available even when
--disallow-code-generation-from-strings
is usedPackage
I've only tested the first 4 packages of this list, only
@nestjs/core
succeeded (but it's possible one of the imports is failing. This issue is likely relevant to all packages):@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
9.2.1
Packages versions
Node.js version
18.13.0
In which operating systems have you tested?
Other
I think this can be fixed by including an ESM export map file, like I've done in other projects here: https://github.com/sequelize/sequelize/blob/main/src/decorators/legacy/index.mjs (+ test to ensure it stays up to date)
The text was updated successfully, but these errors were encountered: