@@ -163,31 +163,33 @@ ForkTsCheckerWebpackPlugin.prototype.pluginStop = function () {
163
163
164
164
ForkTsCheckerWebpackPlugin . prototype . pluginCompile = function ( ) {
165
165
this . compiler . plugin ( 'compile' , function ( ) {
166
- if ( this . cancellationToken ) {
167
- // request cancellation if there is not finished job
168
- this . cancellationToken . requestCancellation ( ) ;
169
- this . compiler . applyPlugins ( 'fork-ts-checker-cancel' , this . cancellationToken ) ;
170
- }
171
- this . checkDone = false ;
172
- this . compilationDone = false ;
173
-
174
- this . started = process . hrtime ( ) ;
166
+ this . compiler . applyPluginsAsync ( 'fork-ts-checker-service-before-start' , function ( ) {
167
+ if ( this . cancellationToken ) {
168
+ // request cancellation if there is not finished job
169
+ this . cancellationToken . requestCancellation ( ) ;
170
+ this . compiler . applyPlugins ( 'fork-ts-checker-cancel' , this . cancellationToken ) ;
171
+ }
172
+ this . checkDone = false ;
173
+ this . compilationDone = false ;
175
174
176
- // create new token for current job
177
- this . cancellationToken = new CancellationToken ( ) ;
178
- if ( ! this . service || ! this . service . connected ) {
179
- this . spawnService ( ) ;
180
- }
175
+ this . started = process . hrtime ( ) ;
181
176
182
- try {
183
- this . service . send ( this . cancellationToken ) ;
184
- } catch ( error ) {
185
- if ( ! this . silent && this . logger ) {
186
- this . logger . error ( this . colors . red ( 'Cannot start checker service: ' + ( error ? error . toString ( ) : 'Unknown error' ) ) ) ;
177
+ // create new token for current job
178
+ this . cancellationToken = new CancellationToken ( ) ;
179
+ if ( ! this . service || ! this . service . connected ) {
180
+ this . spawnService ( ) ;
187
181
}
188
182
189
- this . compiler . applyPlugins ( 'fork-ts-checker-service-start-error' , error ) ;
190
- }
183
+ try {
184
+ this . service . send ( this . cancellationToken ) ;
185
+ } catch ( error ) {
186
+ if ( ! this . silent && this . logger ) {
187
+ this . logger . error ( this . colors . red ( 'Cannot start checker service: ' + ( error ? error . toString ( ) : 'Unknown error' ) ) ) ;
188
+ }
189
+
190
+ this . compiler . applyPlugins ( 'fork-ts-checker-service-start-error' , error ) ;
191
+ }
192
+ } . bind ( this ) ) ;
191
193
} . bind ( this ) ) ;
192
194
} ;
193
195
0 commit comments