refactor: improve file path resolution (#55)

This commit is contained in:
Kaine 2023-12-12 15:33:31 +08:00 committed by GitHub
parent 3ba1315e72
commit 48e8f2c196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,8 @@
// @ts-check // @ts-check
import path from 'node:path' import path from 'node:path'
import { fileURLToPath } from 'node:url'
const dirname = path.dirname(new URL(import.meta.url).pathname) const dirname = path.dirname(fileURLToPath(new URL(import.meta.url)))
const resolve = (/** @type {string} */ p) => const resolve = (/** @type {string} */ p) =>
path.resolve(dirname, '../../packages', p) path.resolve(dirname, '../../packages', p)