Skip to content
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

Provide an ES Module entrypoint for @elastic/elasticsearch #1743

Closed
adamyeats opened this issue Aug 9, 2022 · 12 comments
Closed

Provide an ES Module entrypoint for @elastic/elasticsearch #1743

adamyeats opened this issue Aug 9, 2022 · 12 comments

Comments

@adamyeats
Copy link

Related to #1281 and #1742.

🚀 Feature Proposal

@elastic/elasticsearch is currently a CommonJS module. While CommonJS isn't going away any time soon, ECMAScript Modules are very much "the future" of the JavaScript ecosystem. As the community moves in this direction, it may be wise for us to consider moving this library in the same way.

To accommodate both CJS and ESM users, we might want to create an ES module wrapper that exports both a CJS and ESM version of the library.

At the very least, as suggested in #1281, it would be good to make the type of the module explicit in package.json if we decide to remain with CJS for the time being.

Motivation

This will allow the library to work in Deno, and enable asynchronous module loading in Deno and Node.js.

Copy link
Contributor

github-actions bot commented Nov 3, 2023

This issue is stale because it has been open 90 days with no activity. Remove the stale label, or leave a comment, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Nov 3, 2023
@JoshMock JoshMock removed the stale label Nov 6, 2023
@JoshMock
Copy link
Member

JoshMock commented Nov 6, 2023

Still relevant. We've got Deno/Bun.js support on the long-term roadmap. I recently merged #1281 to explicitly declare the library as a CommonJS package, but improving to include ESM support will be an important step toward multi-runtime compatibility.

@karfau
Copy link

karfau commented Dec 5, 2023

FYI: I'm able to use import * as elasticsearch from "npm:@elasticsearch/elasticsearch"; in Deno already without any issues.

Copy link
Contributor

github-actions bot commented Mar 5, 2024

This issue is stale because it has been open 90 days with no activity. Remove the stale label, or leave a comment, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Mar 5, 2024
@JoshMock JoshMock removed the stale label Mar 5, 2024
@karfau
Copy link

karfau commented Mar 6, 2024

4 months ago it was said it is still relevant

@JoshMock
Copy link
Member

JoshMock commented Mar 6, 2024

thanks for your patience, @karfau. I was on leave for 2 months, just getting back to addressing open issues now.

Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove the stale label, or leave a comment, or this will be closed in 14 days.

Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove the stale label, or leave a comment, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Oct 16, 2024
@JoshMock JoshMock removed the stale label Oct 17, 2024
@karfau
Copy link

karfau commented Oct 17, 2024

At least for more recent deno versions this might have been "resolved" by improved nodejs compatibility...

@JoshMock
Copy link
Member

It would still be ideal to have good ESM support soon, since that's the unified standard everyone is moving toward. I managed to improve things a bit for @elastic/transport recently, so it should hopefully be relatively straightforward by adding exports metadata to package.json.

@harshulj
Copy link

harshulj commented Nov 17, 2024

@JoshMock
Copy link
Member

Fixed in #2475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants