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

ESM support #9

Open
MSE99 opened this issue May 31, 2021 · 9 comments
Open

ESM support #9

MSE99 opened this issue May 31, 2021 · 9 comments

Comments

@MSE99
Copy link

MSE99 commented May 31, 2021

Feature request

I'm currently working on a tool that uses import-from to invoke node module look up inside different directories,
i need es modules support in the future and would really appreciate, it being implemented in this package, thanks.

@sindresorhus
Copy link
Owner

ESM support will not be possible until loader hooks are done: nodejs/node#36396

@yordis
Copy link

yordis commented Jan 20, 2022

@sindresorhus is it ready now?

@sindresorhus
Copy link
Owner

Screen Shot 2022-01-20 at 13 04 28

@yordis
Copy link

yordis commented Jan 20, 2022

@sindresorhus I was referring to your previous comment:

ESM support will not be possible until loader hooks are done: nodejs/node#36396

I didn't intend to ask if the work was done already. My apologies for the confusion. Was trying to figure out if now is the time to tackle the open issue.

@sindresorhus
Copy link
Owner

@yordis
Copy link

yordis commented Jan 20, 2022

Got it, thank you for the help on the topic ... trying to understand the situations from multiple angles, is really confusing.

Thank you thou, following those issues as well

@fisker
Copy link

fisker commented Jul 19, 2022

Resolve first by import-meta-resolve?

@sheerlox
Copy link

while trying to tackle this issue for semantic-release/commit-analyzer#297 (comment), I came up with a draft ESM port of this module, without using loader hooks (note: it is a pure ESM package, so cannot be used in CJS projects).

my approach is probably a bit naive, but it is working perfectly for our use cases. I would greatly appreciate feedback on what I've done, so if anyone is still encountering this issue and would like to try out my solution, please check out my import-from-esm project.

@sindresorhus I would especially appreciate your feedback on this if you would agree to give it a quick look since you are way more experienced than I am on that topic.

@sheerlox
Copy link

It's been a month since my last message, and I wanted to inform you that import-from-esm is no longer in the draft stage. Although it's not entirely complete as there may be use cases we haven't encountered yet, it's currently stable.

Several @semantic-release packages have been using it for around two weeks now, and we've come across a few corner cases that I was able to address quickly, which I will continue to do in the future.

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

5 participants