one
Version:
One is a new React Framework that makes Vite serve both native and web.
14 lines (13 loc) • 582 B
JavaScript
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
const cache = /* @__PURE__ */new Map();
async function workerImport(relativePath, callerUrl) {
const callerDir = dirname(fileURLToPath(callerUrl)),
absolutePath = resolve(callerDir, relativePath),
cacheKey = absolutePath;
if (cache.has(cacheKey)) return cache.get(cacheKey);
const mod = await import(absolutePath.endsWith(".mjs") ? absolutePath : `${absolutePath}.mjs`);
return cache.set(cacheKey, mod), mod;
}
export { workerImport };
//# sourceMappingURL=workerImport.mjs.map