@@ -144,7 +144,7 @@ export async function* runEsBuildBuildAction(
144144 // Output the first build results after setting up the watcher to ensure that any code executed
145145 // higher in the iterator call stack will trigger the watcher. This is particularly relevant for
146146 // unit tests which execute the builder and modify the file system programmatically.
147- yield emitOutputResult ( result , outputOptions ) ;
147+ yield * emitOutputResults ( result , outputOptions ) ;
148148
149149 // Finish if watch mode is not enabled
150150 if ( ! watcher ) {
@@ -196,7 +196,7 @@ export async function* runEsBuildBuildAction(
196196 watcher . remove ( [ ...staleWatchFiles ] ) ;
197197 }
198198
199- yield emitOutputResult (
199+ yield * emitOutputResults (
200200 result ,
201201 outputOptions ,
202202 incrementalResults ? rebuildState . previousOutputInfo : undefined ,
@@ -210,7 +210,7 @@ export async function* runEsBuildBuildAction(
210210 }
211211}
212212
213- function emitOutputResult (
213+ function * emitOutputResults (
214214 {
215215 outputFiles,
216216 assetFiles,
@@ -223,16 +223,18 @@ function emitOutputResult(
223223 } : ExecutionResult ,
224224 outputOptions : NormalizedApplicationBuildOptions [ 'outputOptions' ] ,
225225 previousOutputInfo ?: ReadonlyMap < string , { hash : string ; type : BuildOutputFileType } > ,
226- ) : Result {
226+ ) : Iterable < Result > {
227227 if ( errors . length > 0 ) {
228- return {
228+ yield {
229229 kind : ResultKind . Failure ,
230230 errors : errors as ResultMessage [ ] ,
231231 warnings : warnings as ResultMessage [ ] ,
232232 detail : {
233233 outputOptions,
234234 } ,
235235 } ;
236+
237+ return ;
236238 }
237239
238240 // Template updates only exist if no other JS changes have occurred
@@ -247,7 +249,7 @@ function emitOutputResult(
247249 } ) ) ,
248250 } ;
249251
250- return updateResult ;
252+ yield updateResult ;
251253 }
252254
253255 // Use an incremental result if previous output information is available
@@ -273,6 +275,13 @@ function emitOutputResult(
273275 for ( const file of outputFiles ) {
274276 removedOutputFiles . delete ( file . path ) ;
275277
278+ // Temporarily ignore JS files until Angular compiler plugin refactor to allow
279+ // bypassing application code bundling for template affecting only changes.
280+ // TODO: Remove once refactor is complete.
281+ if ( hasTemplateUpdates && / \. [ c m ] ? j s (?: \. m a p ) ? $ / . test ( file . path ) ) {
282+ continue ;
283+ }
284+
276285 const previousHash = previousOutputInfo . get ( file . path ) ?. hash ;
277286 let needFile = false ;
278287 if ( previousHash === undefined ) {
@@ -312,7 +321,15 @@ function emitOutputResult(
312321 } ;
313322 }
314323
315- return incrementalResult ;
324+ if (
325+ incrementalResult . added . length ||
326+ incrementalResult . modified . length ||
327+ incrementalResult . removed . length
328+ ) {
329+ yield incrementalResult ;
330+ }
331+
332+ return ;
316333 }
317334
318335 // Otherwise, use a full result
@@ -343,5 +360,5 @@ function emitOutputResult(
343360 } ;
344361 }
345362
346- return result ;
363+ yield result ;
347364}
0 commit comments