Skip to content

Commit

Permalink
fix: __dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
enpitsuLin committed Oct 2, 2024
1 parent ade4468 commit 24f3315
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createHash, createHmac } from 'node:crypto'
import { readFileSync } from 'node:fs'
import path from 'node:path'
import path, { dirname } from 'node:path'
import { Script } from 'node:vm'
import { fileURLToPath } from 'node:url'
import { JSDOM } from 'jsdom'
import type { FetchContext } from 'ofetch'
import { stringifyQuery } from 'ufo'
Expand Down Expand Up @@ -77,8 +78,8 @@ export function onSignatureRequest(ctx: FetchContext) {
}

export function createDeviceId() {
// @ts-expect-error ignore
const sdkJsPath = path.resolve(import.meta.dirname, './sm.sdk.js')
const __dirname = fileURLToPath(dirname(import.meta.url))
const sdkJsPath = path.resolve(__dirname, './sm.sdk.js')
return new Promise<string>((resolve) => {
const dom = new JSDOM(
'',
Expand Down

0 comments on commit 24f3315

Please sign in to comment.