UNPKG

@intlayer/config

Version:

Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.

26 lines (24 loc) 859 B
import { configESMxCJSRequire } from "./ESMxCJSHelpers.mjs"; //#region src/utils/clearModuleCache.ts /** * Recursively clears the require cache for a module and all its dependencies */ const clearModuleCache = (modulePath, visited = /* @__PURE__ */ new Set()) => { if (visited.has(modulePath)) return; visited.add(modulePath); try { const resolvedPath = configESMxCJSRequire.resolve(modulePath); const cachedModule = configESMxCJSRequire.cache[resolvedPath]; if (cachedModule) { if (cachedModule.children) cachedModule.children.forEach((child) => { clearModuleCache(child.filename, visited); }); delete configESMxCJSRequire.cache[resolvedPath]; } } catch (error) { console.warn(`Could not clear cache for module: ${modulePath}`, error); } }; //#endregion export { clearModuleCache }; //# sourceMappingURL=clearModuleCache.mjs.map