508 B
508 B
title, tags, firstSeen, lastUpdated
| title | tags | firstSeen | lastUpdated |
|---|---|---|---|
| requireUncached | node,advanced | 2020-08-07T15:49:39+03:00 | 2020-09-15T16:28:04+03:00 |
Loads a module after removing it from the cache (if exists).
- Use
deleteto remove the module from the cache (if exists). - Use
require()to load the module again.
const requireUncached = module => {
delete require.cache[require.resolve(module)];
return require(module);
};
const fs = requireUncached('fs'); // 'fs' will be loaded fresh every time