diff --git a/packages/@dcl/sdk-commands/src/logic/bundle.ts b/packages/@dcl/sdk-commands/src/logic/bundle.ts index e01ddee94..89153dc77 100644 --- a/packages/@dcl/sdk-commands/src/logic/bundle.ts +++ b/packages/@dcl/sdk-commands/src/logic/bundle.ts @@ -218,15 +218,15 @@ function runTypeChecker(components: BundleComponents, options: CompileOptions) { const typeCheckerFuture = future() function runTsc() { - const args = [ - require.resolve('typescript/lib/tsc'), - '-p', - 'tsconfig.json', - options.emitDeclaration ? '--emitDeclarationOnly' : '--noEmit' - ] + const tsBin = require.resolve('typescript/lib/tsc') + const args = ['-p', 'tsconfig.json', options.emitDeclaration ? '--emitDeclarationOnly' : '--noEmit'] printProgressStep(components.logger, `Running type checker`, 2, MAX_STEP) - const ts = child_process.spawn(process.execPath, args, { env: process.env, cwd: options.workingDirectory }) + const ts = child_process.fork(tsBin, args, { + stdio: 'pipe', + env: process.env, + cwd: options.workingDirectory + }) return new Promise((resolve, reject) => { ts.on('close', (code) => { @@ -238,8 +238,8 @@ function runTypeChecker(components: BundleComponents, options: CompileOptions) { } }) - ts.stdout.pipe(process.stdout) - ts.stderr.pipe(process.stderr) + ts.stdout?.pipe(process.stdout) + ts.stderr?.pipe(process.stderr) }) }