@@ -26,7 +26,8 @@ function ForkTsCheckerWebpackPlugin (options) {
26
26
this . ignoreDiagnostics = options . ignoreDiagnostics || [ ] ;
27
27
this . ignoreLints = options . ignoreLints || [ ] ;
28
28
this . logger = options . logger || console ;
29
- this . silent = ! ! options . silent ;
29
+ this . silent = options . silent === true ; // default false
30
+ this . async = options . async !== false ; // default true
30
31
this . workersNumber = options . workers || ForkTsCheckerWebpackPlugin . ONE_CPU ;
31
32
this . memoryLimit = options . memoryLimit || ForkTsCheckerWebpackPlugin . DEFAULT_MEMORY_LIMIT ;
32
33
this . colors = new chalk . constructor ( { enabled : options . colors === undefined ? true : ! ! options . colors } ) ;
@@ -171,7 +172,7 @@ ForkTsCheckerWebpackPlugin.prototype.pluginCompile = function () {
171
172
172
173
ForkTsCheckerWebpackPlugin . prototype . pluginEmit = function ( ) {
173
174
this . compiler . plugin ( 'emit' , function ( compilation , callback ) {
174
- if ( this . isWatching ) {
175
+ if ( this . isWatching && this . async ) {
175
176
callback ( ) ;
176
177
return ;
177
178
}
@@ -188,7 +189,7 @@ ForkTsCheckerWebpackPlugin.prototype.pluginEmit = function () {
188
189
189
190
ForkTsCheckerWebpackPlugin . prototype . pluginDone = function ( ) {
190
191
this . compiler . plugin ( 'done' , function ( ) {
191
- if ( ! this . isWatching ) {
192
+ if ( ! this . isWatching || ! this . async ) {
192
193
return ;
193
194
}
194
195
@@ -306,7 +307,7 @@ ForkTsCheckerWebpackPlugin.prototype.handleServiceMessage = function (message) {
306
307
this . compiler . applyPlugins ( 'fork-ts-checker-receive' , this . diagnostics , this . lints ) ;
307
308
308
309
if ( this . compilationDone ) {
309
- this . isWatching ? this . doneCallback ( ) : this . emitCallback ( ) ;
310
+ ( this . isWatching && this . async ) ? this . doneCallback ( ) : this . emitCallback ( ) ;
310
311
}
311
312
} ;
312
313
0 commit comments