File tree 3 files changed +21
-20
lines changed
3 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -168,11 +168,13 @@ async function createDepsOptimizer(
168
168
let optimizingNewDeps : Promise < DepOptimizationResult > | undefined
169
169
async function close ( ) {
170
170
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
+ ] )
176
178
}
177
179
178
180
if ( ! cachedMetadata ) {
Original file line number Diff line number Diff line change @@ -106,20 +106,19 @@ export async function scanImports(config: ResolvedConfig): Promise<{
106
106
const { plugins = [ ] , ...esbuildOptions } =
107
107
config . optimizeDeps ?. esbuildOptions ?? { }
108
108
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
+ } )
123
122
124
123
debug ( `Scan completed in ${ ( performance . now ( ) - start ) . toFixed ( 2 ) } ms:` , deps )
125
124
Original file line number Diff line number Diff line change @@ -419,7 +419,7 @@ export async function createServer(
419
419
process . stdin . off ( 'end' , exitProcess )
420
420
}
421
421
}
422
- await Promise . all ( [
422
+ await Promise . allSettled ( [
423
423
watcher . close ( ) ,
424
424
ws . close ( ) ,
425
425
container . close ( ) ,
You can’t perform that action at this time.
0 commit comments