Uh oh!
There was an error while loading. Please reload this page.
module: refactor commonjs typescript loader - #58657
Conversation
This commit refactors the CommonJS loader to remove TypeScript-specific extensions from the require.extensions object for compatibility with libraries that depended on it to initialize extenal TypeScript loaders.
nodejs-github-bot
commented
Jun 10, 2025
Review requested:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #58657 +/- ##
=======================================
Coverage 90.14% 90.15% =======================================
Files 636 636 Lines 188030 187953 -77 Branches 36894 36882 -12 =======================================
- Hits 169506 169451 -55 + Misses 11276 11268 -8 + Partials 7248 7234 -14
🚀 New features to boost your workflow:
|
nodejs-github-bot
commented
Jun 10, 2025
nodejs-github-bot
commented
Jun 10, 2025
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
nodejs-github-bot
commented
Jun 10, 2025
@marco-ippolito great job! may I ask whether this compatible fix be backported to Node.js 23&24? we're willing to migrate to native typescript support but a easier progressive migration is always preferred. |
marco-ippolito
commented
Jun 11, 2025
v24 yes in the next release |
nodejs-github-bot
commented
Jun 12, 2025
Landed in 708477b |
This commit refactors the CommonJS loader to remove TypeScript-specific extensions from the require.extensions object for compatibility with libraries that depended on it to initialize extenal TypeScript loaders. PR-URL: #58657 Refs: nodejs/typescript#37 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
JLHwung
commented
Jun 23, 2025
With this change, how should a library detect if the current node has enabled builtin strip-types support? Should a library do the version check? Previously in Babel we checked |
|
This commit refactors the CommonJS loader to remove TypeScript-specific extensions from the require.extensions object for compatibility with libraries that depended on it to initialize extenal TypeScript loaders. PR-URL: nodejs#58657 Refs: nodejs/typescript#37 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
This commit refactors the CommonJS loader to remove TypeScript-specific extensions from the require.extensions object for compatibility with libraries that depended on it to initialize extenal TypeScript loaders. PR-URL: #58657 Backport-PR-URL: #57298 Refs: nodejs/typescript#37 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com> PR-URL: #56350Fixes: nodejs/typescript#17
This commit refactors the CommonJS loader to remove TypeScript-specific extensions from the require.extensions object for compatibility with libraries that depended on it to initialize extenal TypeScript loaders. PR-URL: #58657 Backport-PR-URL: #57298 Refs: nodejs/typescript#37 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com> PR-URL: #56350Fixes: nodejs/typescript#17
Refs: nodejs/typescript#37
As suggested by @joyeecheungnodejs/typescript#37 (comment), we can refactor the commonjs loader so that we dont have to expose in the
Module._extensionsthe TypeScript file extensions.This should unblock the backport of Type Stripping in Node v22.
I tested it against @hardfisthttps://github.com/hardfist/webpack-ts-break and it fixes the breaking change: