File tree Expand file tree Collapse file tree 3 files changed +21
-20
lines changed
Expand file tree Collapse file tree 3 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -168,11 +168,13 @@ async function createDepsOptimizer(
168168 let optimizingNewDeps : Promise < DepOptimizationResult > | undefined
169169 async function close ( ) {
170170 closed = true
171- await discoverProjectDependenciesPromise ?. catch ( ( ) => {
172- /* ignore error for scanner because it's not important */
173- } )
174- await postScanOptimizationResult
175- await optimizingNewDeps
171+ await Promise . allSettled ( [
172+ discoverProjectDependenciesPromise ?. catch ( ( ) => {
173+ /* ignore error for scanner because it's not important */
174+ } ) ,
175+ postScanOptimizationResult ,
176+ optimizingNewDeps ,
177+ ] )
176178 }
177179
178180 if ( ! cachedMetadata ) {
Original file line number Diff line number Diff line change @@ -106,20 +106,19 @@ export async function scanImports(config: ResolvedConfig): Promise<{
106106 const { plugins = [ ] , ...esbuildOptions } =
107107 config . optimizeDeps ?. esbuildOptions ?? { }
108108
109- await Promise . all (
110- entries . map ( ( entry ) =>
111- build ( {
112- absWorkingDir : process . cwd ( ) ,
113- write : false ,
114- entryPoints : [ entry ] ,
115- bundle : true ,
116- format : 'esm' ,
117- logLevel : 'error' ,
118- plugins : [ ...plugins , plugin ] ,
119- ...esbuildOptions ,
120- } ) ,
121- ) ,
122- )
109+ await build ( {
110+ absWorkingDir : process . cwd ( ) ,
111+ write : false ,
112+ stdin : {
113+ contents : entries . map ( ( e ) => `import '${ e } '` ) . join ( '\n' ) ,
114+ loader : 'js' ,
115+ } ,
116+ bundle : true ,
117+ format : 'esm' ,
118+ logLevel : 'error' ,
119+ plugins : [ ...plugins , plugin ] ,
120+ ...esbuildOptions ,
121+ } )
123122
124123 debug ( `Scan completed in ${ ( performance . now ( ) - start ) . toFixed ( 2 ) } ms:` , deps )
125124
Original file line number Diff line number Diff line change @@ -419,7 +419,7 @@ export async function createServer(
419419 process . stdin . off ( 'end' , exitProcess )
420420 }
421421 }
422- await Promise . all ( [
422+ await Promise . allSettled ( [
423423 watcher . close ( ) ,
424424 ws . close ( ) ,
425425 container . close ( ) ,
You can’t perform that action at this time.
0 commit comments