@@ -212,8 +212,8 @@ export async function bundleSingleProject(components: BundleComponents, options:
212212}
213213
214214function runTypeChecker ( components : BundleComponents , options : CompileOptions ) {
215+ const tsBin = require . resolve ( 'typescript/lib/tsc' )
215216 const args = [
216- require . resolve ( 'typescript/lib/tsc' ) ,
217217 '-p' ,
218218 'tsconfig.json' ,
219219 '--preserveWatchOutput' ,
@@ -224,7 +224,11 @@ function runTypeChecker(components: BundleComponents, options: CompileOptions) {
224224 if ( options . watch ) args . push ( '--watch' )
225225
226226 printProgressStep ( components . logger , `Running type checker` , 2 , MAX_STEP )
227- const ts = child_process . spawn ( process . execPath , args , { env : process . env , cwd : options . workingDirectory } )
227+ const ts = child_process . fork ( tsBin , args , {
228+ stdio : 'pipe' ,
229+ env : process . env ,
230+ cwd : options . workingDirectory
231+ } )
228232 const typeCheckerFuture = future < number > ( )
229233
230234 ts . on ( 'close' , ( code ) => {
@@ -239,8 +243,8 @@ function runTypeChecker(components: BundleComponents, options: CompileOptions) {
239243 typeCheckerFuture . resolve ( code )
240244 } )
241245
242- ts . stdout . pipe ( process . stdout )
243- ts . stderr . pipe ( process . stderr )
246+ ts . stdout ? .pipe ( process . stdout )
247+ ts . stderr ? .pipe ( process . stderr )
244248
245249 /* istanbul ignore if */
246250 if ( options . watch ) {
0 commit comments