Skip to content

Commit 5fc6a9d

Browse files
authored
move 'spawn' ts checker to 'fork' (#1074)
1 parent 06e2154 commit 5fc6a9d

File tree

1 file changed

+8
-4
lines changed
  • packages/@dcl/sdk-commands/src/logic

1 file changed

+8
-4
lines changed

packages/@dcl/sdk-commands/src/logic/bundle.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ export async function bundleSingleProject(components: BundleComponents, options:
212212
}
213213

214214
function 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

Comments
 (0)