@@ -135,27 +135,16 @@ function createCompiler(
135135 } ) ;
136136
137137 let isFirstCompile = true ;
138- let isTsCheckInProgress = false ;
139138 let tsMessagesPromise ;
140139 let tsMessagesResolver ;
141140
142141 if ( useTypeScript ) {
143142 compiler . hooks . beforeCompile . tap ( 'beforeCompile' , ( ) => {
144- isTsCheckInProgress = true ;
145143 tsMessagesPromise = new Promise ( resolve => {
146- tsMessagesResolver = msgs => {
147- isTsCheckInProgress = false ;
148- resolve ( msgs ) ;
149- } ;
144+ tsMessagesResolver = msgs => resolve ( msgs ) ;
150145 } ) ;
151146 } ) ;
152147
153- compiler . hooks . compilation . tap ( 'compilation' , async compilation => {
154- const messages = await tsMessagesPromise ;
155- compilation . errors . push ( ...messages . errors ) ;
156- compilation . warnings . push ( ...messages . warnings ) ;
157- } ) ;
158-
159148 forkTsCheckerWebpackPlugin
160149 . getCompilerHooks ( compiler )
161150 . receive . tap ( 'afterTypeScriptCheck' , ( diagnostics , lints ) => {
@@ -190,17 +179,25 @@ function createCompiler(
190179 errors : true ,
191180 } ) ;
192181
193- if ( useTypeScript && statsData . errors . length === 0 && isTsCheckInProgress ) {
194- console . log (
195- chalk . yellow (
196- 'Files successfully emitted, waiting for typecheck results...'
197- )
198- ) ;
182+ if ( useTypeScript && statsData . errors . length === 0 ) {
183+ const delayedMsg = setTimeout ( ( ) => {
184+ console . log (
185+ chalk . yellow (
186+ 'Files successfully emitted, waiting for typecheck results...'
187+ )
188+ ) ;
189+ } , 100 ) ;
199190
200191 const messages = await tsMessagesPromise ;
192+ clearTimeout ( delayedMsg ) ;
201193 statsData . errors . push ( ...messages . errors ) ;
202194 statsData . warnings . push ( ...messages . warnings ) ;
203195
196+ // Push errors and warnings into compilation result
197+ // to show them after page refresh triggered by user.
198+ stats . compilation . errors . push ( ...messages . errors ) ;
199+ stats . compilation . warnings . push ( ...messages . warnings ) ;
200+
204201 if ( messages . errors . length > 0 ) {
205202 devSocket . errors ( messages . errors ) ;
206203 } else if ( messages . warnings . length > 0 ) {
0 commit comments