Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65424fa

Browse files
authored
fix: improve json import (anuraghazra#2190)
1 parentf7a2b21 commit65424fa

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎src/cards/wakatime-card.js‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ import { wakatimeCardLocales } from "../translations.js";
1818
* since vercel is using v16.14.0 which does not yet support json imports without the
1919
* --experimental-json-modules flag.
2020
*/
21-
import{createRequire}from"module";
22-
constrequire=createRequire(import.meta.url);
23-
constlanguageColors=require("../common/languageColors.json");// now works
21+
import{readFileSync}from"fs";
22+
importpathfrom"path";
23+
import{fileURLToPath}from"url";
24+
const__filename=fileURLToPath(import.meta.url);
25+
const__dirname=path.dirname(__filename);
26+
constlanguageColors=JSON.parse(
27+
readFileSync(
28+
path.resolve(__dirname,"../common/languageColors.json"),
29+
"utf8",
30+
),
31+
);
2432

2533
/**
2634
* Creates the no coding activity SVG node.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp