File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { spawn } from 'node:child_process';
22import fsP from 'node:fs/promises' ;
33import { createRequire } from 'node:module' ;
44import path from 'node:path' ;
5+ import { pathToFileURL } from 'node:url' ;
56import { logger } from '@rsbuild/core' ;
67import color from 'picocolors' ;
78import type ts from 'typescript' ;
@@ -29,7 +30,16 @@ const getTsgoBinPath = async (): Promise<string> => {
2930 './lib/getExePath.js' ,
3031 ) ;
3132
32- return import ( libPath ) . then ( ( mod ) => {
33+ // handle Windows paths
34+ // On Windows, absolute paths must be valid file:// URLs
35+ let fileUrl : string ;
36+ if ( process . platform === 'win32' ) {
37+ fileUrl = pathToFileURL ( libPath ) . href ;
38+ } else {
39+ fileUrl = libPath ;
40+ }
41+
42+ return import ( fileUrl ) . then ( ( mod ) => {
3343 const getExePath = mod . default ;
3444 return getExePath ( ) ;
3545 } ) ;
You can’t perform that action at this time.
0 commit comments