clear-module

JSON →
library 4.1.3 ·javascript maintenance
verified Jun 7, 2026

Clear a module from the Node.js require cache, forcing a fresh reload on the next require. Current stable version is 4.1.3 (last updated 2020, Node >=8). It recursively clears the target module and all its parent modules from the cache. Alternatives like delete require.cache[require.resolve(...)] do not handle recursive clearing. Common use case: testing where modules have state or need to be reloaded. Ships TypeScript definitions. Low maintenance, no dependencies.