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

textlint-script: support ESM outputs #1123

Open
azu opened this issue Mar 25, 2023 · 2 comments · May be fixed by #1126
Open

textlint-script: support ESM outputs #1123

azu opened this issue Mar 25, 2023 · 2 comments · May be fixed by #1126
Labels
Status: Proposal Request for comments

Comments

@azu
Copy link
Member

azu commented Mar 25, 2023

Current textlint-scripts build output CJS.
However, textlint v13.0.0 support native ESM rule.

textlint-scripts need to support ESM outputs.

Proposal A

Add textlint-scripts-esm and textlint-scripts --esm like ts-node

  • Require to output .mjs because package.json may not have type=module

Proposal B

If package.json has type=module, textlint-scripts output ESM

  • Require to run npm pkg set "type"="module" before using textlint-scripts

Note 📝

  • Use "exports": "./src/index.js" instead of main
  • Use ts-node/esm instead of ts-node
  • Need to update template repository
    • Should We use ESM by default?
@azu azu added the Status: Proposal Request for comments label Mar 25, 2023
@azu
Copy link
Member Author

azu commented Mar 25, 2023

textlint-scripts test transpile js on the fly.
It requires babel loader.

📝 We can run tests without loader in js mode beause babel only transpile ES2015+ syntax.
However, in ts mode, we need to get loader like babel loader or ts-node/esm

@azu azu linked a pull request Mar 25, 2023 that will close this issue
@azu
Copy link
Member Author

azu commented Jan 2, 2024

Customization Hooks is RC.

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

Successfully merging a pull request may close this issue.

1 participant