-
Notifications
You must be signed in to change notification settings - Fork 126
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
support cjs and mjs file extensions #1847
base: main
Are you sure you want to change the base?
Conversation
Is it not possible to make the default |
I haven’t tested (will do later) but I would guess that would break with cjs-style files? |
@Fil What do you mean by “make the |
We can add default support for more extensions. My suggestion however was not about that, but rather to explore if we could pass more options to I'm also experimenting with |
`--experimental-top-level-await` test
The old documentation suggests that this option may be obsolete, as Here is the documentation on when node will choose to go into ESM mode versus commonjs mode. It's a very unfortunate situation, but it seems to me that letting people opt in to one or the other explicitly via their choice of file extensions would be useful in framework |
Yes, I'm convinced. Thanks for the detailed explanation! |
I was surprised to find that these default node file extensions weren't supported by default, so I added them
This is particularly helpful so that you can write data loader scripts with top-level await and with ESM import syntax, by saving them with the
.mjs
file extension