File tree Expand file tree Collapse file tree 3 files changed +23
-16
lines changed
packages/angular/build/src/builders Expand file tree Collapse file tree 3 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,8 @@ function* emitOutputResults(
264264 const incrementalResult : IncrementalResult = {
265265 kind : ResultKind . Incremental ,
266266 warnings : warnings as ResultMessage [ ] ,
267+ // These files need to be updated in the dev server but should not signal any updates
268+ background : hasTemplateUpdates ,
267269 added : [ ] ,
268270 removed : [ ] ,
269271 modified : [ ] ,
@@ -281,13 +283,6 @@ function* emitOutputResults(
281283 for ( const file of outputFiles ) {
282284 removedOutputFiles . delete ( file . path ) ;
283285
284- // Temporarily ignore JS files until Angular compiler plugin refactor to allow
285- // bypassing application code bundling for template affecting only changes.
286- // TODO: Remove once refactor is complete.
287- if ( hasTemplateUpdates && / \. j s (?: \. m a p ) ? $ / . test ( file . path ) ) {
288- continue ;
289- }
290-
291286 const previousHash = previousOutputInfo . get ( file . path ) ?. hash ;
292287 let needFile = false ;
293288 if ( previousHash === undefined ) {
@@ -299,6 +294,11 @@ function* emitOutputResults(
299294 }
300295
301296 if ( needFile ) {
297+ // Updates to non-JS files must signal an update with the dev server
298+ if ( ! / (?: \. j s | \. m a p ) ? $ / . test ( file . path ) ) {
299+ incrementalResult . background = false ;
300+ }
301+
302302 incrementalResult . files [ file . path ] = {
303303 type : file . type ,
304304 contents : file . contents ,
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export interface FullResult extends BaseResult {
3636
3737export interface IncrementalResult extends BaseResult {
3838 kind : ResultKind . Incremental ;
39+ background ?: boolean ;
3940 added : string [ ] ;
4041 removed : { path : string ; type : BuildOutputFileType } [ ] ;
4142 modified : string [ ] ;
Original file line number Diff line number Diff line change @@ -217,6 +217,7 @@ export async function* serveWithVite(
217217 } ) ;
218218 }
219219
220+ let needClientUpdate = true ;
220221 switch ( result . kind ) {
221222 case ResultKind . Full :
222223 if ( result . detail ?. [ 'htmlIndexPath' ] ) {
@@ -261,6 +262,9 @@ export async function* serveWithVite(
261262 case ResultKind . Incremental :
262263 assert ( server , 'Builder must provide an initial full build before incremental results.' ) ;
263264
265+ // Background updates should only update server files/options
266+ needClientUpdate = ! result . background ;
267+
264268 for ( const removed of result . removed ) {
265269 const filePath = '/' + normalizePath ( removed . path ) ;
266270 generatedFiles . delete ( filePath ) ;
@@ -363,15 +367,17 @@ export async function* serveWithVite(
363367 ] ) ,
364368 ] ;
365369
366- await handleUpdate (
367- normalizePath ,
368- generatedFiles ,
369- assetFiles ,
370- server ,
371- serverOptions ,
372- context . logger ,
373- componentStyles ,
374- ) ;
370+ if ( needClientUpdate ) {
371+ await handleUpdate (
372+ normalizePath ,
373+ generatedFiles ,
374+ assetFiles ,
375+ server ,
376+ serverOptions ,
377+ context . logger ,
378+ componentStyles ,
379+ ) ;
380+ }
375381 } else {
376382 const projectName = context . target ?. project ;
377383 if ( ! projectName ) {
You can’t perform that action at this time.
0 commit comments