A utility to clear Node.js's require cache in a controlled, selective way. Version 2.1.2 is stable with no recent updates. Unlike blanket cache clearing, it uses filter and bubble callbacks to selectively wipe specific modules and their dependents. Useful for testing to reload modules freshly without restarting the process.
npm install wipe-node-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Selectively wipes module './foo.js' from require cache, then re-requires it to get fresh instance.
Ensure first argument is an object of stubs or null; do not mix filter and stub logic.
Always guard against undefined module: if (module) { /* use module */ }Return true in bubbleCallback for modules you want to wipe; false to keep them.
Check if module is defined before calling path.dirname(module).
Avoid wiping core modules or modules not in the regular load path; use filter to exclude node_modules.
No dependency data recorded yet.