cyco130 2 days ago

I believe at least the Vitest project considered using node:module hooks for live reloading but rejected it in the past. The reason given to me was that, there is no way to garbage-collect a real EcmaScript module since they're always reachable by the module ID string as per the specification.

This kind of leak was deemed acceptable in a browser tab (which we tend to close or reload often) but unacceptable for a long-running server process.

Pseudo-modules based on node:vm, on the other hand, will be collected normally when they become unreachable.