File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ type InternalTransformerOptions = TransformerArgs<Options.Typescript> & {
25
25
26
26
const injectedCodeSeparator = 'const $$$$$$$$ = null;' ;
27
27
28
+ /**
29
+ * Map of valid tsconfigs (no errors). Key is the path.
30
+ */
31
+ const tsconfigMap = new Map < string , any > ( ) ;
32
+
28
33
function createFormatDiagnosticsHost ( cwd : string ) : ts . FormatDiagnosticsHost {
29
34
return {
30
35
getCanonicalFileName : ( fileName : string ) =>
@@ -355,6 +360,13 @@ export function loadTsconfig(
355
360
356
361
basePath = dirname ( tsconfigFile ) ;
357
362
363
+ if ( tsconfigMap . has ( tsconfigFile ) ) {
364
+ return {
365
+ errors : [ ] ,
366
+ options : tsconfigMap . get ( tsconfigFile ) ,
367
+ } ;
368
+ }
369
+
358
370
const { error, config } = ts . readConfigFile ( tsconfigFile , ts . sys . readFile ) ;
359
371
360
372
if ( error ) {
@@ -375,6 +387,10 @@ export function loadTsconfig(
375
387
// Filter out "no files found error"
376
388
errors = errors . filter ( ( d ) => d . code !== 18003 ) ;
377
389
390
+ if ( errors . length === 0 ) {
391
+ tsconfigMap . set ( tsconfigFile , options ) ;
392
+ }
393
+
378
394
return { errors, options } ;
379
395
}
380
396
You can’t perform that action at this time.
0 commit comments