Skip to content

Commit

Permalink
Merge pull request #285 from db-ui/fix-ReferenceError-filename-is-not…
Browse files Browse the repository at this point in the history
…-defined

fix: `ReferenceError: __filename is not defined`
  • Loading branch information
mfranzke authored Oct 1, 2024
2 parents 4fd1522 + 4c1c2d0 commit d38b0e6
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": "NodeNext",
"declaration": true,
"outDir": "dist",
"moduleResolution": "node",
"esModuleInterop": true,
"moduleResolution": "NodeNext",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,

Expand Down

0 comments on commit d38b0e6

Please sign in to comment.