-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
CommonJS module output broken after updating from 5.5.4 to 5.6.2 #59991
Comments
bisects to #59479 |
So it seems that before this PR it would ignore the fact that your files are authored using We can trace back this work to #57896 and #58825 . They mention that from now on extensions should be considered in more This is a one-line change to fix your issue but the changed code is also almost explicit when it comes to applying the new logic for extensions regardless of Minimal repro case: // @moduleResolution: node10
// @module: commonjs
// @filename: index.mts
export const foo = '' |
Yes, this is working as intended. Compiling .mts files to CommonJS-containing .mjs files was not something we ever intended to support—the fact that it ever worked was a bug / unintentional side effect of other work. |
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Thanks for the answer! I'll review how I dual ship then. It might be good to document cases where tsc ignore settings. I combed through the documentation first and this behavior didn't appear obvious to me. |
If you were relying on |
Came across this issue using My issue was the resolved file was the Of course the above makes total sense, but wonder if your going to ignore |
🔎 Search Terms
5.6 commonjs cjs node10 moduleResolution modules regression
🕗 Version & Regression Information
inquirer
Chore(deps-dev): Bump typescript from 5.5.4 to 5.6.2 SBoudrias/Inquirer.js#1554⏯ Playground Link
SBoudrias/Inquirer.js#1554
💻 Code
My tsconfig.cjs.json
🙁 Actual behavior
The files outputted in
dist/cjs
are now using esm module syntax instead fo cjs (import ... from
).🙂 Expected behavior
As of version 5.5.4, the files outputted in
dist/cjs
were cjs (require(...)
).Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: