sindresorhus / import-fresh

Import a module while bypassing the cache
MIT License
284 stars 25 forks source link

Support ESM #22

Open sindresorhus opened 3 years ago

sindresorhus commented 3 years ago

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

aral commented 2 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.

legobeat commented 1 year ago

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