Compare commits

...

2 Commits

2 changed files with 8 additions and 4 deletions

View File

@ -1,13 +1,11 @@
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { resolve } from "node:path";
import type { PresetAsset } from "presetter-types";
let DIR: string;
if (typeof __dirname === "undefined") {
// @ts-ignore
DIR = dirname(fileURLToPath(import.meta.url));
DIR = (await import("./path.js")).default();
} else {
DIR = __dirname;
}

6
src/path.ts Normal file
View File

@ -0,0 +1,6 @@
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
export default function () {
return dirname(fileURLToPath(import.meta.url));
}