diff --git a/build/lib/tsb/index.js b/build/lib/tsb/index.js index 252b32f01a5..44b9bc862dd 100644 --- a/build/lib/tsb/index.js +++ b/build/lib/tsb/index.js @@ -51,8 +51,11 @@ function create(projectPath, existingOptions, config, onError = _defaultOnError) } } // FULL COMPILE stream doing transpile, syntax and semantic diagnostics + let _builder; function createCompileStream(token) { - const _builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine); + if (!_builder) { + _builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine); + } return through(function (file) { // give the file to the compiler if (file.isStream()) { diff --git a/build/lib/tsb/index.ts b/build/lib/tsb/index.ts index 3342dd65dfe..548094bbf03 100644 --- a/build/lib/tsb/index.ts +++ b/build/lib/tsb/index.ts @@ -73,9 +73,13 @@ export function create( } // FULL COMPILE stream doing transpile, syntax and semantic diagnostics + + let _builder!: builder.ITypeScriptBuilder; function createCompileStream(token?: builder.CancellationToken): Readable & Writable { - const _builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine); + if (!_builder) { + _builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine); + } return through(function (this: through.ThroughStream, file: Vinyl) { // give the file to the compiler