Skip to content

Commit

Permalink
perf(compiler): remove createProgram for isolatedModules: true to…
Browse files Browse the repository at this point in the history
… boost startup speed (#1941)

Since `transpile` API is used for `isolatedModules: true`, `createProgram` does not do anything with it. Therefore we can remove it
  • Loading branch information
zhming0 committed Sep 11, 2020
1 parent 949ffb2 commit dd84534
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/compiler/transpiler.ts
Expand Up @@ -10,9 +10,8 @@ import type { CompilerInstance, SourceOutput } from '../types'
export const initializeTranspilerInstance = (configs: ConfigSet, logger: Logger): CompilerInstance => {
logger.debug('initializeTranspilerInstance(): create typescript compiler')

const { options, fileNames } = configs.parsedTsConfig
const { options } = configs.parsedTsConfig
const ts = configs.compilerModule
const program = ts.createProgram(fileNames, options)

return {
compileFn: (code: string, fileName: string): SourceOutput => {
Expand All @@ -31,6 +30,6 @@ export const initializeTranspilerInstance = (configs: ConfigSet, logger: Logger)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return [result.outputText, result.sourceMapText!]
},
program,
program: undefined,
}
}

0 comments on commit dd84534

Please sign in to comment.