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