DEV Community

LG
LG

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

References:

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay