Open sindresorhus opened 3 years ago
This is easy to implement but imperfect currently (see https://github.com/small-tech/import-fresh#readme) as Node.js cannot currently invalidate ESM modules without leaking memory.
Most recent update from Node.js team: https://github.com/nodejs/node/issues/49442
API stabilizing seems to not be happening any time soonish and there are some workarounds mentioned which may be appplicable here in the meantime?
https://github.com/nodejs/node/issues/49442
https://gist.github.com/marxangels/68c1e50fe144c4ec4c911a6534aa7e32
We need to wait for the loader hooks to be stable first: https://nodejs.org/dist/latest/docs/api/esm.html#esm_hooks
https://github.com/nodejs/node/issues/49442