@@ -57,46 +57,45 @@ export async function* esbuildExecutor(
57
57
options ,
58
58
context
59
59
) ;
60
- const result = await esbuild . build ( {
61
- ...esbuildOptions ,
62
- watch :
63
- // Only emit info on one of the watch processes.
64
- idx === 0
65
- ?{
66
- onRebuild :async (
67
- error :esbuild . BuildFailure ,
68
- result :esbuild . BuildResult
69
- ) => {
70
- if ( ! options . skipTypeCheck ) {
71
- const { errors} = await runTypeCheck (
72
- options ,
73
- context
74
- ) ;
75
- hasTypeErrors = errors . length > 0 ;
76
- }
77
- const success = ! error && ! hasTypeErrors ;
78
-
79
- if ( ! success ) {
80
- logger . info ( BUILD_WATCH_FAILED ) ;
81
- } else {
82
- logger . info ( BUILD_WATCH_SUCCEEDED ) ;
83
- }
84
-
85
- next ( {
86
- success :! ! error && ! hasTypeErrors ,
87
- outfile :esbuildOptions . outfile ,
88
- } ) ;
89
- } ,
90
- }
91
- :true ,
92
- } ) ;
93
-
94
- next ( {
95
- success,
96
- outfile :esbuildOptions . outfile ,
97
- } ) ;
98
-
99
- return result ;
60
+ const watch =
61
+ // Only emit info on one of the watch processes.
62
+ idx === 0
63
+ ?{
64
+ onRebuild :async (
65
+ error :esbuild . BuildFailure ,
66
+ result :esbuild . BuildResult
67
+ ) => {
68
+ if ( ! options . skipTypeCheck ) {
69
+ const { errors} = await runTypeCheck ( options , context ) ;
70
+ hasTypeErrors = errors . length > 0 ;
71
+ }
72
+ const success = ! error && ! hasTypeErrors ;
73
+
74
+ if ( ! success ) {
75
+ logger . info ( BUILD_WATCH_FAILED ) ;
76
+ } else {
77
+ logger . info ( BUILD_WATCH_SUCCEEDED ) ;
78
+ }
79
+
80
+ next ( {
81
+ success :! ! error && ! hasTypeErrors ,
82
+ outfile :esbuildOptions . outfile ,
83
+ } ) ;
84
+ } ,
85
+ }
86
+ :true ;
87
+ try {
88
+ const result = await esbuild . build ( { ...esbuildOptions , watch} ) ;
89
+
90
+ next ( {
91
+ success :true ,
92
+ outfile :esbuildOptions . outfile ,
93
+ } ) ;
94
+
95
+ return result ;
96
+ } catch {
97
+ next ( { success :false } ) ;
98
+ }
100
99
} )
101
100
) ;
102
101
const processOnExit = ( ) => {