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

[Question] Non-ESM Support #25

Closed
gaby opened this issue May 4, 2022 · 5 comments
Closed

[Question] Non-ESM Support #25

gaby opened this issue May 4, 2022 · 5 comments

Comments

@gaby
Copy link

gaby commented May 4, 2022

Is there a way to use this library without ESM, which has been abandoned for a long time?

@gaby gaby changed the title Non-ESM Support [Question] Non-ESM Support May 4, 2022
@tcollinsworth
Copy link
Owner

Aside from native ESM by using package.json type: module or loading from a .mjs instead of .js file, not sure. I recently leaned it's possible to start node with -r esm or -r esm-wallaby too. Then the project does not need to directly depend on esm. The esm library is still widely used. The esm-wallaby library is a fork of esm but adds optional-chaining (elvis), so that's mostly what I'm using these days. I haven't switched to native esm because of the limitations on code modification which is needed for sinon stubs/spies and newrelic agent to instrument code. Been trying to identify solutions to those issues, but currently unaware of alternatives that won't require major refactoring.

@gaby
Copy link
Author

gaby commented May 5, 2022

@tcollinsworth Thank you for your time and great explanation, looking forward to using this library to resolve dns issues!

@ozyman42
Copy link

Can't get this to work w/ jest due to the module exporting ESM

@scythargon
Copy link

ugh
I need this too

@tcollinsworth
Copy link
Owner

You can dynamically load ESM module before loading this module. Alternatively, if you are using native esm, I could create a native esm version.

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

No branches or pull requests

4 participants