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(textlint-script): support import() #1284

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

azu
Copy link
Member

@azu azu commented Nov 7, 2023

textlint-script should not transpile import() to require(). It will be required for ESM support.

textlint 13 support Node.js 16+. so This change is not breaking change.

This PR allow a rule to use native import().
It will help the rule to import ESM modules from CJS.

Resources

TS's node12 and node 16 is similar flags.

microsoft/TypeScript#43329

textlint-script should not transpile `import()` to `require()`.
It will be required for ESM support.
@azu azu linked an issue Nov 7, 2023 that may be closed by this pull request
@azu azu added the Type: Feature New Feature label Nov 7, 2023
Comment on lines +14 to +18
},
// Allow to use native `import()` for loading ESM modules
// https://github.com/babel/babel/issues/10194
// TODO: It will not required in Babel 8
exclude: ["proposal-dynamic-import"]
Copy link
Member Author

Choose a reason for hiding this comment

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

Allow rules to use native import()

@azu azu merged commit 9925b62 into master Nov 7, 2023
17 checks passed
@azu azu deleted the 1283-textlint-scripts-preverse-import branch November 7, 2023 23:59
@github-actions github-actions bot mentioned this pull request Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

textlint-scripts: preverse import()
1 participant