-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESM import issue (replicated with Deno v2 and Node 23) #2466
Comments
This is not just Deno. Just happened on Node 23 as well for me. The new *.16 release is broken. |
I expected so, but I only tried it in deno. |
@JoshMock I am mentioning you here, as I believe you'd be interested in knowing that the latest version doesn't work at all. It can't even be imported. |
This is crazy, how not a single javascript user can use elastic right now, this should be a urgent issue!!!!!!! |
So it's really a bug? Any workaround on this? |
Just down grade to 7.16.10 or whatever the prior major version was and that will fix issue for now. |
A quick turnaround would be greatly appreciated. |
I think @ajkraus04 advice is wrong: the issue comes from So before |
This
|
We need {
"exports": {
".": {
"types": "./index.d.ts",
"default": "./index.js"
}
}
} |
Thanks for your patience, everyone. I've opened #2475 with a fix, as well as a smoke test to ensure ECMAScript imports continue to work going forward. I will publish a patch release 8.16.1 today with the fix. This was only was broken for 8.16.0, so downgrading to 8.15.x is a temporary fix. It was also only broken for code using native ECMAScript |
8.16.1 has been published with the ESM |
@JoshMock I'm still noticing weird behaviours on 8.16.1, the following fails despite working on 8.15 and previous releases. import type {
SearchRequest,
SearchResponse
} from '@elastic/elasticsearch/lib/api/types'; Specifically it fails with |
@augustozanellato import type {estypes} from '@elastic/elasticsearch';
let req: estypes.SearchRequest; |
That indeed solved my issue, thanks. |
Yep, |
🐛 Bug report
With v8.16.0 in a deno v2 project, we run into the following problem when running:
For what I can see, the issue is in the
exports
section of the package.json. Probably should be"exports": { ".": "./index.js" },
(replace "require" with ".")The issue is not present with 8.15.x versions, which are commonjs packages entirely.
To reproduce
In a deno v2 (potentially also other ESM runtimes), install version 8.16.0 and run your app and/or any tests that uses a file that imports the es library.
Expected behavior
Should be imported and run as expected
Node.js version
Deno v2
@elastic/elasticsearch version
8.16.0
Operating system
Debian bookworm
Any other relevant environment information
No response
The text was updated successfully, but these errors were encountered: