88
99import type { BuilderContext , BuilderOutput } from '@angular-devkit/architect' ;
1010import type { logging } from '@angular-devkit/core' ;
11- import { existsSync } from 'node:fs' ;
1211import type { ComponentStylesheetBundler } from '../../tools/esbuild/angular/component-stylesheets' ;
1312import {
1413 resetSassWorkerPoolCaches ,
@@ -211,7 +210,6 @@ async function executeBuild(
211210 return output ;
212211 } catch ( error ) {
213212 assertIsError ( error ) ;
214- logger . error ( error . message ) ;
215213 logBuildResult ( logger , startTime , false ) ;
216214
217215 return { success : false , error : error . message } ;
@@ -262,16 +260,10 @@ async function* runWatchLoop(
262260 stylesheetBundler . invalidate ( rawChangedFiles ) ;
263261 const changedFiles = buildState . getAffectedFiles ( rawChangedFiles ) ;
264262
265- const shouldResetSassCache =
266- changedFiles . has ( packageJsonPath ) ||
267- rawChangedFiles . some ( ( file ) => file . endsWith ( '/package.json' ) ) ||
268- Array . from ( changes . added ) . some ( ( file ) => / \. (?: s c s s | s a s s | c s s ) $ / i. test ( file ) ) ||
269- Array . from ( changes . removed ) . some ( ( file ) => / \. (?: s c s s | s a s s | c s s ) $ / i. test ( file ) ) ||
270- Array . from ( changes . modified ) . some (
271- ( file ) => / \. (?: s c s s | s a s s | c s s ) $ / i. test ( file ) && ! existsSync ( file ) ,
272- ) ;
273-
274- if ( shouldResetSassCache ) {
263+ const hasStyleChanges = Array . from ( changedFiles ) . some ( ( file ) =>
264+ / \. (?: s c s s | s a s s | c s s ) $ / i. test ( file ) ,
265+ ) ;
266+ if ( hasStyleChanges ) {
275267 resetSassWorkerPoolCaches ( ) ;
276268 }
277269
@@ -290,12 +282,9 @@ async function* runWatchLoop(
290282 buildState . hasCompilationError = true ;
291283 }
292284
293- const message = `Failed to reload 'package.json': ${ error . message } ` ;
294- logger . error ( message ) ;
295-
296285 yield {
297286 success : false ,
298- error : message ,
287+ error : `Failed to reload 'package.json': ${ error . message } ` ,
299288 } ;
300289 continue ;
301290 }
0 commit comments