A Node.js library (v1.9.0, stable) to clear the require cache for a specified JS file, including parsing and removing cache for its internal dependencies. Useful for hot-reloading or testing scenarios where cached modules must be invalidated. Ships TypeScript types. Minimal overhead with no runtime dependencies. Activates on first call, with subsequent calls being no-ops.
npm install delete-node-require-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing and using delRequireCache to clear the require cache for a specific file.
Manually handle nested dependencies if required, or call delRequireCache on each root module.
Check if the module exists in require.cache before calling, or use a try-catch block.
Use dynamic import: import('delete-node-require-cache').then(m => m.delRequireCache(filePath)).Change import delRequireCache from ... to import { delRequireCache } from ...Ensure the file is required before calling delRequireCache, or add error handling.
No dependency data recorded yet.