@@ -60,12 +60,17 @@ function getCompilerOptions({
60
60
61
61
const compilerOptions : CompilerOptions = {
62
62
target : ts . ScriptTarget . ES2015 ,
63
- ...( convertedCompilerOptions as CompilerOptions ) ,
63
+ ...convertedCompilerOptions ,
64
64
// force module(resolution) to esnext and a compatible moduleResolution. Reason:
65
65
// transpileModule treats NodeNext as CommonJS because it doesn't read the package.json.
66
66
// Also see https://github.com/microsoft/TypeScript/issues/53022 (the filename workaround doesn't work).
67
67
module : ts . ModuleKind . ESNext ,
68
- moduleResolution : ts . ModuleResolutionKind . Node10 ,
68
+ moduleResolution :
69
+ convertedCompilerOptions . moduleResolution ===
70
+ ts . ModuleResolutionKind . Bundler
71
+ ? ts . ModuleResolutionKind . Bundler
72
+ : ts . ModuleResolutionKind . Node10 ,
73
+ customConditions : undefined , // fails when using an invalid moduleResolution combination which could happen when we force moduleResolution to Node10
69
74
allowNonTsExtensions : true ,
70
75
// Clear outDir since it causes source map issues when the files aren't actually written to disk.
71
76
outDir : undefined ,
@@ -141,7 +146,10 @@ export function loadTsconfig(
141
146
compilerOptionsJSON : any ,
142
147
filename : string ,
143
148
tsOptions : Options . Typescript ,
144
- ) {
149
+ ) : {
150
+ options : ts . CompilerOptions ;
151
+ errors : ts . Diagnostic [ ] ;
152
+ } {
145
153
if ( typeof tsOptions . tsconfigFile === 'boolean' ) {
146
154
return { errors : [ ] , options : compilerOptionsJSON } ;
147
155
}
0 commit comments