one
Version:
One is a new React Framework that makes Vite serve both native and web.
18 lines (17 loc) • 623 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));
var absolutePath = resolve(callerDir, relativePath);
var cacheKey = absolutePath;
if (cache.has(cacheKey)) {
return cache.get(cacheKey);
}
var mjsPath = absolutePath.endsWith(".mjs") ? absolutePath : `${absolutePath}.mjs`;
var mod = await import(mjsPath);
cache.set(cacheKey, mod);
return mod;
}
export { workerImport };
//# sourceMappingURL=workerImport.native.js.map