Skip to content

Commit 1784ac5

Browse files
committed
fix(esm): replace __dirname with import.meta.url equivalent
1 parent ca5f810 commit 1784ac5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/generator.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ import satori from 'satori'
22
import { Resvg } from '@resvg/resvg-js'
33
import * as fs from 'fs'
44
import * as path from 'path'
5+
import { fileURLToPath } from 'url'
56
import { SocialPreviewTemplate } from './template.js'
67
import type { RepoData } from './github.js'
78

9+
// ESM equivalent of __dirname
10+
const __filename = fileURLToPath(import.meta.url)
11+
const __dirname = path.dirname(__filename)
12+
813
const IMAGE_WIDTH = 1280
914
const IMAGE_HEIGHT = 640
1015

0 commit comments

Comments
 (0)