DEV Community

Lukas Gaucas
Lukas Gaucas

Posted on

Node.js module system + purge the cache for CJS

Follow comments carefully within code source . A few important assumptions emphasized tho :

  • module .require(d) synchronously
  • module cached the very first time it's required : every subsequent require will point to the same module's reference
  • not possible to require() files that have the .mjs extension : attempting to do so will throw an error as it's reserved for ESM


Discussion (0)