[ai-document-intelligence] Loading from an ESM module still doesn't seem to work fine. Still loads CJS #30020
Labels
Client
This issue points to a problem in the data-plane of the library.
Cognitive - Form Recognizer
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
RestLevelClient
Describe the bug
I'm using this
tsconfig.json
The TS files are translated directly to ESM without converting them to commonjs, since Node supports running ESM.
When trying to import the default function from
'@azure-rest/ai-document-intelligence'
I get a TS error if I want to call it directly:using
DocumentIntelligence.default()
fixes this issue.Since this is a monorepo, another projects imports this Node app (just for the types). And that causes issues, since that project is using Next.js, and as such is not yet converted to
type: "module"
.I've ran the Node project using
NODE_DEBUG=esm
to figure out which file is actually imported.it seems that it's still loading the CJS file instead the one from
/dist-esm/
.A simple solution would be to also provide a non-default export so these issues don't appear.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect to be able to import the project in an ESM project
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
given above
The text was updated successfully, but these errors were encountered: