Skip to content

Commit

Permalink
fix: ReferenceError: __filename is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzke committed Oct 1, 2024
1 parent 4fd1522 commit ff20fb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/generate-icon-fonts/svg-to-font.ts
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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("/");
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"module": "Node16",
"declaration": true,
"outDir": "dist",
"moduleResolution": "node",
"esModuleInterop": true,
"moduleResolution": "Node16",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,

Expand Down

0 comments on commit ff20fb3

Please sign in to comment.