@@ -32,22 +32,26 @@ export async function watchAsync(options: BuildOptions): Promise<void> {
3232 } )
3333 }
3434 watcher . on ( 'change' , async function ( file : string ) : Promise < void > {
35- log . clearViewport ( )
36- const getElapsedTime = trackElapsedTime ( )
37- log . info ( `Changed ${ yellow ( file ) } ` )
38- const promises : Array < Promise < void > > = [ ]
39- if ( packageJsonRegex . test ( file ) === true ) {
40- promises . push ( buildManifestAsync ( minify ) )
41- } else {
42- if ( cssRegex . test ( file ) === true ) {
43- promises . push ( buildCssModulesTypingsAsync ( ) )
35+ try {
36+ log . clearViewport ( )
37+ const getElapsedTime = trackElapsedTime ( )
38+ log . info ( `Changed ${ yellow ( file ) } ` )
39+ const promises : Array < Promise < void > > = [ ]
40+ if ( packageJsonRegex . test ( file ) === true ) {
41+ promises . push ( buildManifestAsync ( minify ) )
42+ } else {
43+ if ( cssRegex . test ( file ) === true ) {
44+ promises . push ( buildCssModulesTypingsAsync ( ) )
45+ }
4446 }
45- }
46- promises . push ( buildBundlesAsync ( minify ) )
47- await Promise . all ( promises )
48- log . success ( `Built in ${ getElapsedTime ( ) } ` )
49- if ( typecheck === false ) {
50- log . info ( 'Watching...' )
47+ promises . push ( buildBundlesAsync ( minify ) )
48+ await Promise . all ( promises )
49+ log . success ( `Built in ${ getElapsedTime ( ) } ` )
50+ if ( typecheck === false ) {
51+ log . info ( 'Watching...' )
52+ }
53+ } catch ( error ) {
54+ log . error ( error . message )
5155 }
5256 } )
5357}
0 commit comments