@@ -101,7 +101,9 @@ export function createCompiler(configs: ConfigSet): TsCompiler {
101
101
? configs . filterDiagnostics ( result . diagnostics )
102
102
: [ ]
103
103
104
- if ( diagnosticList . length ) throw configs . createTsError ( diagnosticList )
104
+ if ( diagnosticList . length ) {
105
+ throw configs . createTsError ( diagnosticList )
106
+ }
105
107
106
108
return [ result . outputText , result . sourceMapText as string ]
107
109
}
@@ -174,16 +176,18 @@ export function createCompiler(configs: ConfigSet): TsCompiler {
174
176
175
177
const output = service . getEmitOutput ( fileName )
176
178
177
- // Get the relevant diagnostics - this is 3x faster than `getPreEmitDiagnostics`.
178
- const diagnostics = service
179
- . getCompilerOptionsDiagnostics ( )
180
- . concat ( service . getSyntacticDiagnostics ( fileName ) )
181
- . concat ( service . getSemanticDiagnostics ( fileName ) )
179
+ if ( configs . shouldReportDiagnostic ( fileName ) ) {
180
+ // Get the relevant diagnostics - this is 3x faster than `getPreEmitDiagnostics`.
181
+ const diagnostics = service
182
+ . getCompilerOptionsDiagnostics ( )
183
+ . concat ( service . getSyntacticDiagnostics ( fileName ) )
184
+ . concat ( service . getSemanticDiagnostics ( fileName ) )
182
185
183
- const diagnosticList = configs . filterDiagnostics ( diagnostics )
186
+ const diagnosticList = configs . filterDiagnostics ( diagnostics )
184
187
185
- if ( diagnosticList . length ) {
186
- throw configs . createTsError ( diagnosticList )
188
+ if ( diagnosticList . length ) {
189
+ throw configs . createTsError ( diagnosticList )
190
+ }
187
191
}
188
192
189
193
if ( output . emitSkipped ) {
0 commit comments