File tree 3 files changed +23
-16
lines changed
packages/angular/build/src/builders
3 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,8 @@ function* emitOutputResults(
264
264
const incrementalResult : IncrementalResult = {
265
265
kind : ResultKind . Incremental ,
266
266
warnings : warnings as ResultMessage [ ] ,
267
+ // These files need to be updated in the dev server but should not signal any updates
268
+ background : hasTemplateUpdates ,
267
269
added : [ ] ,
268
270
removed : [ ] ,
269
271
modified : [ ] ,
@@ -281,13 +283,6 @@ function* emitOutputResults(
281
283
for ( const file of outputFiles ) {
282
284
removedOutputFiles . delete ( file . path ) ;
283
285
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
-
291
286
const previousHash = previousOutputInfo . get ( file . path ) ?. hash ;
292
287
let needFile = false ;
293
288
if ( previousHash === undefined ) {
@@ -299,6 +294,11 @@ function* emitOutputResults(
299
294
}
300
295
301
296
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
+
302
302
incrementalResult . files [ file . path ] = {
303
303
type : file . type ,
304
304
contents : file . contents ,
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export interface FullResult extends BaseResult {
36
36
37
37
export interface IncrementalResult extends BaseResult {
38
38
kind : ResultKind . Incremental ;
39
+ background ?: boolean ;
39
40
added : string [ ] ;
40
41
removed : { path : string ; type : BuildOutputFileType } [ ] ;
41
42
modified : string [ ] ;
Original file line number Diff line number Diff line change @@ -217,6 +217,7 @@ export async function* serveWithVite(
217
217
} ) ;
218
218
}
219
219
220
+ let needClientUpdate = true ;
220
221
switch ( result . kind ) {
221
222
case ResultKind . Full :
222
223
if ( result . detail ?. [ 'htmlIndexPath' ] ) {
@@ -261,6 +262,9 @@ export async function* serveWithVite(
261
262
case ResultKind . Incremental :
262
263
assert ( server , 'Builder must provide an initial full build before incremental results.' ) ;
263
264
265
+ // Background updates should only update server files/options
266
+ needClientUpdate = ! result . background ;
267
+
264
268
for ( const removed of result . removed ) {
265
269
const filePath = '/' + normalizePath ( removed . path ) ;
266
270
generatedFiles . delete ( filePath ) ;
@@ -363,15 +367,17 @@ export async function* serveWithVite(
363
367
] ) ,
364
368
] ;
365
369
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
+ }
375
381
} else {
376
382
const projectName = context . target ?. project ;
377
383
if ( ! projectName ) {
You can’t perform that action at this time.
0 commit comments