webpack-mock-server
Version:
Mocks api requests for webpack-dev-server with hot-replacement
17 lines (16 loc) • 634 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = clearNodeCache;
const log_1 = __importDefault(require("./log"));
function clearNodeCache(rootPath) {
Object.keys(require.cache).forEach((key) => {
var _a;
if ((_a = require.cache[key]) === null || _a === void 0 ? void 0 : _a.filename.startsWith(rootPath)) {
log_1.default.debug("delete node-cache for", key);
delete require.cache[key];
}
});
}