Is it possible to "deregister" a loader hook? #55624
-
import { register } from 'node:module'
export function registerLoader() {
register('./loader.mjs', import.meta.url)
}
export function deregisterLoader() {
// ...
} Is it possible to deregister a specific hook? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
There was a PR opened for this, but it looks like it has kinda stalled: #49159 Currently it's not possible. What would be your use-case for this? |
Beta Was this translation helpful? Give feedback.
-
In Node.js, as of now, there's no built-in API to deregister a specific module loader hook that was registered with register() from the 'module' package. Once a loader is registered, it remains active for the entire lifecycle of the process, and there's no official method to undo this or remove a specific hook. If you need a workaround, here are a few approaches to consider:
Future Support |
Beta Was this translation helpful? Give feedback.
There was a PR opened for this, but it looks like it has kinda stalled: #49159
Currently it's not possible. What would be your use-case for this?