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

Use ESM template by default instead of CommonJS #631

Open
2 tasks done
piranna opened this issue Jun 8, 2023 · 2 comments
Open
2 tasks done

Use ESM template by default instead of CommonJS #631

piranna opened this issue Jun 8, 2023 · 2 comments

Comments

@piranna
Copy link
Contributor

piranna commented Jun 8, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

EcmaScript modules are supported by all maintained Node.js versions since long ago, so there's no need to use CommonJS modules anymore. I propose to make --esm flag enabled by default, and maybe also fully remove templates for CommonJS. Typescript templates would need to be updated too to generate ESM modules, but although tricky, it's a minor fix.

Motivation

Embrace new and future prove standards, and deprecate old ones.

Example

No response

@mcollina
Copy link
Member

mcollina commented Jun 8, 2023

While ESM module loading is stable, I don't think ESM is ready yet for general adoption due to the lack of stable loaders API. Take a look at nodejs/TSC#1397.

@piranna
Copy link
Contributor Author

piranna commented Jun 8, 2023

While ESM module loading is stable, I don't think ESM is ready yet for general adoption due to the lack of stable loaders API. Take a look at nodejs/TSC#1397.

You are right, I have had the same problems with loaders regarding Typescript + ESM combo, that's why I put the comment about it, but definitely it's a boomer.

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

2 participants