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

Add support for ESM custom syntaxes #7351

Merged
merged 3 commits into from Nov 21, 2023
Merged

Add support for ESM custom syntaxes #7351

merged 3 commits into from Nov 21, 2023

Conversation

ybiquitous
Copy link
Member

Which issue, if any, is this issue related to?

Closes #7269

Is there anything in the PR that needs further explanation?

The dynamic import() supports both ESM and CJS.

Copy link

changeset-bot bot commented Nov 20, 2023

🦋 Changeset detected

Latest commit: ab38fa2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

} catch (error) {
if (
error &&
typeof error === 'object' &&
'code' in error &&
error.code === 'MODULE_NOT_FOUND' &&
(error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_MODULE_NOT_FOUND') &&
Copy link
Member Author

Choose a reason for hiding this comment

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

[note] The path of error.code === 'ERR_MODULE_NOT_FOUND' is not covered in tests for some reason. I guess Babel under Jest may transform the import() code, but I'm not sure.

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

Nice work! LGTM, thank you.

@ybiquitous ybiquitous merged commit b0c7876 into main Nov 21, 2023
15 of 16 checks passed
@ybiquitous ybiquitous deleted the issue-7269 branch November 21, 2023 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Support custom syntax for ESM
3 participants