A tiny utility to require Node.js modules while bypassing the module cache. Current stable version is 0.0.6 (released 2015, no updates since). It accepts a file path and the require function reference, then temporarily deletes the module from require.cache before loading, ensuring a fresh copy. Intended primarily for testing scenarios where stubbing or mocking modules requires uncached imports. Unlike other solutions that require explicit cache deletion, this wraps the require call to do it automatically.
npm install require-without-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: loading a module without cache by passing the path and the require function.
Always pass the local 'require' (the one in scope) to ensure correct cache operations.
If using a custom require, ensure it has 'resolve' and 'cache' properties as described in the documentation.
For modern Node.js (>=14), consider using dynamic import() or other uncaching strategies.
Ensure the module is not imported elsewhere before calling requireWithoutCache, or use it before the first require.
Only use this package in Node.js environment where require.cache is available.
No dependency data recorded yet.