Skip to content

Commit

Permalink
fix: pnp loader path on Windows (#126)
Browse files Browse the repository at this point in the history
krossekrabbe authored Jan 25, 2023
1 parent 644cd74 commit 758aaf1
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/pnp-loader-windows-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"synckit": patch
---

fix: pnp loader path on Windows

6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -249,7 +249,11 @@ const setupTsRunner = (
execArgv = ['-r', pnpApiPath, ...execArgv]
const pnpLoaderPath = path.resolve(pnpApiPath, '../.pnp.loader.mjs')
if (isFile(pnpLoaderPath)) {
execArgv = ['--experimental-loader', pnpLoaderPath, ...execArgv]
// Transform path to file URL because nodejs does not accept
// absolute Windows paths in the --experimental-loader option.
// https://github.com/un-ts/synckit/issues/123
const experimentalLoader = pathToFileURL(pnpLoaderPath).toString()
execArgv = ['--experimental-loader', experimentalLoader, ...execArgv]
}
}
}

0 comments on commit 758aaf1

Please sign in to comment.