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

feat(plugins): add support for loading ESM plugins #2688

Merged
merged 3 commits into from Jan 25, 2023
Merged

Conversation

travi
Copy link
Member

@travi travi commented Jan 25, 2023

this cherry-picks commits that originally landed in the current beta branch in order to backport the esm plugin loading capability into the mainline ahead of the beta branch landing.

@travi travi requested a review from gr2m January 25, 2023 00:57
Comment on lines +55 to +66
if (isFunction(name)) {
return name;
}

return name;
const file = resolveFrom.silent(basePath, name) || resolveFrom(cwd, name);
const { default: cjsExport, ...esmNamedExports } = await import(`file://${file}`);

if (cjsExport) {
return cjsExport;
}

return esmNamedExports;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implementation has changed slightly because of merging it with the fix for windows support of v20

Copy link
Member

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code changes look good to me 👍🏼

@travi
Copy link
Member Author

travi commented Jan 25, 2023

we're still having some trouble with our test suite completing successfully, especially in node v19. i dont believe the changes in this PR impact that situation and I would want to address that separately anyway, once we can figure out the root cause.

short of understanding that, i'm going to go ahead and merge this change since we have successful verification from the parts that completed.

@travi travi changed the title feat(plugins): adds support for loading ESM plugins feat(plugins): add support for loading ESM plugins Jan 25, 2023
@travi travi merged commit d170f73 into master Jan 25, 2023
@travi travi deleted the esm-plugins branch January 25, 2023 05:24
@github-actions
Copy link

🎉 This PR is included in version 20.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 21.0.0-beta.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants