delete
to remove the module from the cache (if exists).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
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️