iles
Version:
Vite & Vue powered static site generator with partial hydration
19 lines (17 loc) • 475 B
JavaScript
// src/node/modules.ts
function unwrapDefault(mod) {
return mod?.default ? unwrapDefault(mod.default) : mod;
}
function importModule(path) {
if (process.platform === "win32") {
if (path.match(/^\w:\\/))
return import(`file:///${path.replace(/\\/g, "/")}`).then(unwrapDefault);
if (path.match(/^\w:\//))
return import(`file:///${path}`).then(unwrapDefault);
}
return import(path).then(unwrapDefault);
}
export {
unwrapDefault,
importModule
};