Skip to content

Commit

Permalink
fix: use fileURLToPath
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Nov 5, 2023
1 parent f9a5609 commit ad78573
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/utils/pkgJsonUtils.ts
@@ -1,4 +1,5 @@
import { readFileSync, writeFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { resolve as importResolve } from 'import-meta-resolve';
import type { PackageJson } from './packageTypes';

Expand All @@ -19,10 +20,5 @@ export function internalLoadPackageJsonFromNodeModules(
`${pkgDepName}/package.json`,
`file://${pkgDirname}/package.json`,
);
return readPkgJson(
packageUrl.replace(
process.platform === 'win32' ? /^file:\/{3}/ : /^file:\/\//,
'',
),
);
return readPkgJson(fileURLToPath(packageUrl));
}

0 comments on commit ad78573

Please sign in to comment.