shellphone.app/server/purge-require-cache.ts

9 lines
194 B
TypeScript

export function purgeRequireCache() {
const resolved = require.resolve("../build");
for (const key in require.cache) {
if (key.startsWith(resolved)) {
delete require.cache[key];
}
}
}