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

PR: Discussion deprecate the default of CommonJS #45766

Closed
lemanschik opened this issue Dec 7, 2022 · 2 comments
Closed

PR: Discussion deprecate the default of CommonJS #45766

lemanschik opened this issue Dec 7, 2022 · 2 comments
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@lemanschik
Copy link

lemanschik commented Dec 7, 2022

What is the problem this feature will solve?

I guess this will solve on the long run that ESM would maybe start working with a higher rate then CJS.

What is the feature you are proposing to solve the problem?

package.json when nothing got set should default to module. not commonjs

What alternatives have you considered?

Loaders, Loader Hooks, Import Require Flags,

The legendary npm:esm@latest package which implements the whole ESM logic in userland over require.

Addition for reactions on this topic

thumbs down and up do mean a LGTM +1 if you do not supply any additions as the fact that you simply care about it shows me we are on the right track.

Compat matrix

import() will fail when loading a .js file that uses require without that it exists in a place where a package json type commonjs is near.
import will work if i create a require on globalThis

in any other case import will work as it is ESM.

Additional context

@lemanschik lemanschik added the feature request Issues that request new features to be added to Node.js. label Dec 7, 2022
@bnoordhuis
Copy link
Member

Duplicate of #33954. See discussion in that issue for details but to summarize: not happening anytime soon, if ever.

@lemanschik
Copy link
Author

@bnoordhuis your correct. will close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

No branches or pull requests

2 participants