-
Notifications
You must be signed in to change notification settings - Fork 636
fix: load mts config without type module #3750
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
fix: load mts config without type module #3750
Conversation
Could you give a reproduction for it, I'm not sure what happened at here. |
I believe I managed to reproduce: In stackblitz this errors out since it uses node 18 (tries to parse as cjs), but the exact warning can be reproduced when using node v22.14 (not specifically, just what I had on hand)
Do note that I don't believe this PR fixes the warning, but I could be mistaken in that regard. |
Reproduction is the same as @Joery-M mentioned. This PR aim for no Regardless of the value of the "type" field, .mjs files are always treated as ES modules and .cjs files are always treated as CommonJS. If |
Thanks for your description. I updated the pr to add the tests, and also fixed load the cts error, it need to compiled the cts to cjs. |
Description
If developer forces module type via specifing TypeScript extension,
Make JS extension follow TS extension,
Node.js read file's module correctly even if it doesn't match "type" field within package.json
This PR can resolve below Node.js warning (when use
rolldown.config.mts
)