fix: add __dirname compatibility

This commit is contained in:
Derrick Hammer 2023-06-25 16:58:29 -04:00
parent a5f166210d
commit 60f45cb8d5
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 1 deletions

View File

@ -3,7 +3,14 @@ import { fileURLToPath } from "node:url";
import type { PresetAsset } from "presetter-types"; 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 // paths to the template directory
const TEMPLATES = resolve(DIR, "..", "templates"); const TEMPLATES = resolve(DIR, "..", "templates");