When loading modules with await import()
in Node.js, they become permanently cached. The subsequent await import(url)
, given the same url
will return the exact same module.
If one needs to pick up the changes made to file system, they need custom loader hooks.
For this purpose specifically, only resolve
is sufficient (note how mtime
is used for cache busting).
Warning! The old modules are never actually reclaimed from memory, so some additional considerations must be taken into account: