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
Enhancement to redirection feature added in #23 and #30
We can install a redirector for require() by patching Module._resolveFilename but we can't do that for ESM loader hooks. If a loader hook wants to redirect, it needs to call out to us directly.
Consumers like ts-node who implement their own loader hooks may want to do the same redirection. We can expose a function they can use to do this redirection. Perhaps it can even support our redirection callback? Perhaps not since ESM loaders will eventually run in a separate thread.
Should it be implemented as a loader itself? To support chaining? Probably not since it would be more complex, and most likely the only consumer of this feature is going to be ts-node.
The text was updated successfully, but these errors were encountered:
Enhancement to redirection feature added in #23 and #30
We can install a redirector for
require()
by patchingModule._resolveFilename
but we can't do that for ESM loader hooks. If a loader hook wants to redirect, it needs to call out to us directly.Consumers like ts-node who implement their own loader hooks may want to do the same redirection. We can expose a function they can use to do this redirection. Perhaps it can even support our redirection callback? Perhaps not since ESM loaders will eventually run in a separate thread.
Should it be implemented as a loader itself? To support chaining? Probably not since it would be more complex, and most likely the only consumer of this feature is going to be ts-node.
The text was updated successfully, but these errors were encountered: