mirror of
https://github.com/anuraghazra/github-readme-stats.git
synced 2025-01-24 13:59:08 +08:00
fix: improve json import (#2190)
This commit is contained in:
parent
f7a2b2162b
commit
65424fa90f
@ -18,9 +18,17 @@ import { wakatimeCardLocales } from "../translations.js";
|
|||||||
* since vercel is using v16.14.0 which does not yet support json imports without the
|
* since vercel is using v16.14.0 which does not yet support json imports without the
|
||||||
* --experimental-json-modules flag.
|
* --experimental-json-modules flag.
|
||||||
*/
|
*/
|
||||||
import { createRequire } from "module";
|
import { readFileSync } from "fs";
|
||||||
const require = createRequire(import.meta.url);
|
import path from "path";
|
||||||
const languageColors = require("../common/languageColors.json"); // now works
|
import { fileURLToPath } from "url";
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const languageColors = JSON.parse(
|
||||||
|
readFileSync(
|
||||||
|
path.resolve(__dirname, "../common/languageColors.json"),
|
||||||
|
"utf8",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the no coding activity SVG node.
|
* Creates the no coding activity SVG node.
|
||||||
|
Loading…
Reference in New Issue
Block a user