diff --git a/src/index.ts b/src/index.ts index c7c13d2..6abadfd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,14 @@ import { fileURLToPath } from "node:url"; import type { PresetAsset } from "presetter-types"; -const DIR = dirname(fileURLToPath(import.meta.url)); +let DIR: string; + +if (typeof __dirname === "undefined") { + // @ts-ignore + DIR = dirname(fileURLToPath(import.meta.url)); +} else { + DIR = __dirname; +} // paths to the template directory const TEMPLATES = resolve(DIR, "..", "templates");