Open EdwardZZZ opened 5 years ago
function requireNoCache(modulePath, env = process.env.NODE_ENV) { env === 'development' && deleteRequireCache(modulePath); return require(modulePath); } function deleteRequireCache(modulePath) { const module = require.cache[modulePath]; if (!module) return; if (module.parent) { module.parent.children.splice(module.parent.children.indexOf(module), 1); } delete require.cache[modulePath]; }