File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,17 @@ import { wakatimeCardLocales } from "../translations.js";
18
18
* since vercel is using v16.14.0 which does not yet support json imports without the
19
19
* --experimental-json-modules flag.
20
20
*/
21
- import { createRequire } from "module" ;
22
- const require = createRequire ( import . meta. url ) ;
23
- const languageColors = require ( "../common/languageColors.json" ) ; // now works
21
+ import { readFileSync } from "fs" ;
22
+ import path from "path" ;
23
+ import { fileURLToPath } from "url" ;
24
+ const __filename = fileURLToPath ( import . meta. url ) ;
25
+ const __dirname = path . dirname ( __filename ) ;
26
+ const languageColors = JSON . parse (
27
+ readFileSync (
28
+ path . resolve ( __dirname , "../common/languageColors.json" ) ,
29
+ "utf8" ,
30
+ ) ,
31
+ ) ;
24
32
25
33
/**
26
34
* Creates the no coding activity SVG node.
You can’t perform that action at this time.
0 commit comments