sssx
Version:
Fast Svelte Static Site X – SSG/SSR focused on SEO for multi-million pages websites
17 lines (14 loc) • 380 B
text/typescript
import fs from "node:fs";
import { type Module } from "./types.ts";
export const loadExistingModule = async (fullpath: string) => {
if (fs.existsSync(fullpath)) {
const rand = Math.random().toString().slice(2);
const module: Module = await import(`${fullpath}?${rand}`);
return module;
}
return {
all: [],
added: [],
removed: [],
} as Module;
};