diff --git a/src/generate-icon-fonts/svg-to-font.ts b/src/generate-icon-fonts/svg-to-font.ts index 862c17f..f715d0a 100644 --- a/src/generate-icon-fonts/svg-to-font.ts +++ b/src/generate-icon-fonts/svg-to-font.ts @@ -1,7 +1,8 @@ +import { fileURLToPath } from 'node:url'; import path from "node:path"; import svgtofont from "svgtofont"; -import { OptionsType } from "../types"; +import { OptionsType } from "../types.js"; import { log } from "console"; const svgToFont = async ( @@ -11,7 +12,7 @@ const svgToFont = async ( ) => { const { fontName, debug, svgoOptions, outSVGReact, svgicons2svgfont } = options; - const fileName = __filename; + const fileName = fileURLToPath(import.meta.url); let lastSlashIndex = fileName.lastIndexOf("\\"); if (lastSlashIndex === -1) { lastSlashIndex = fileName.lastIndexOf("/"); diff --git a/tsconfig.json b/tsconfig.json index 820e138..0ddd5a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,10 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "NodeNext", "declaration": true, "outDir": "dist", - "moduleResolution": "node", - "esModuleInterop": true, + "moduleResolution": "NodeNext", "experimentalDecorators": true, "emitDecoratorMetadata": true,