You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Describe alternatives to require.extensions #32483
I agree require.extensions should be "undeprecated" or a true alternative should be introduced.
Reacted by songkeys, Anton Demchenko, majo44, aMarCruz, dcharbonnier, theomessin, nika-d, Micael Levi L. Cavalcante, Phil Léger, Raoul de Heer and 16 more
Cannot agree more folks. The solution to be able to load custom extensions within an application by simply using require is pretty paramount. Please provide a sanctioned alternative, I could think of a few, or even a proper API around this.
For example, you could even apply a chain of loaders for a specific extension allowing each to process the output of the previous before the final result appeared. Allowing conditional processing for extension functions and so on.
And it appears that their problem is that neither Bun nor Node 22 added .ts to require.extensions. In node if .ts isn't registered, the library tries to load ts-node, but ts-node does not play nice with Bun.
Everyone in the Node community needs a way to determine if third party library is needed to run TS or not.
Node is the first ecosystem I've been in where deprecation warnings went in before the replacement was production ready.
Deprecated since: v0.10.6
Guys.. come on. This is just embarrassing.
Reacted by Jean-Cédric Huet, Jordan Harband and Ms2ger
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
The recent changes for type erasure have only made this situation more complex because there are subsets of TS that are valid but don't work with the erasure solution.
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
Activity
devsnek commentedon Mar 25, 2020
The goal is for it to be replaced by loaders of some sort (like ESM)
arpowers commentedon Nov 20, 2020
I agree
require.extensionsshould be "undeprecated" or a true alternative should be introduced.nyteshade commentedon Feb 7, 2023
Cannot agree more folks. The solution to be able to load custom extensions within an application by simply using require is pretty paramount. Please provide a sanctioned alternative, I could think of a few, or even a proper API around this.
For example, you could even apply a chain of loaders for a specific extension allowing each to process the output of the previous before the final result appeared. Allowing conditional processing for extension functions and so on.
jdmarshall commentedon Feb 28, 2025
I'm trying to support someone on
node-config/node-config#769
And it appears that their problem is that neither Bun nor Node 22 added .ts to require.extensions. In node if .ts isn't registered, the library tries to load ts-node, but ts-node does not play nice with Bun.
Everyone in the Node community needs a way to determine if third party library is needed to run TS or not.
Node is the first ecosystem I've been in where deprecation warnings went in before the replacement was production ready.
Guys.. come on. This is just embarrassing.
github-actions commentedon Jun 27, 2026
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
jdmarshall commentedon Jun 27, 2026
The recent changes for type erasure have only made this situation more complex because there are subsets of TS that are valid but don't work with the erasure solution.
github-actions commentedon Sep 27, 2026
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
jdmarshall commentedon Sep 27, 2026
Deprecating something imparts a burden of effort to describe the workaround.
doc: point require.extensions users to customization hooks