@@ -711,23 +711,25 @@ async function prepareEsbuildOptimizerRun(
711
711
const { plugins : pluginsFromConfig = [ ] , ...esbuildOptions } =
712
712
optimizeDeps ?. esbuildOptions ?? { }
713
713
714
- for ( const id in depsInfo ) {
715
- const src = depsInfo [ id ] . src !
716
- const exportsData = await ( depsInfo [ id ] . exportsData ??
717
- extractExportsData ( src , config , ssr ) )
718
- if ( exportsData . jsxLoader && ! esbuildOptions . loader ?. [ '.js' ] ) {
719
- // Ensure that optimization won't fail by defaulting '.js' to the JSX parser.
720
- // This is useful for packages such as Gatsby.
721
- esbuildOptions . loader = {
722
- '.js' : 'jsx' ,
723
- ...esbuildOptions . loader ,
714
+ await Promise . all (
715
+ Object . keys ( depsInfo ) . map ( async ( id ) => {
716
+ const src = depsInfo [ id ] . src !
717
+ const exportsData = await ( depsInfo [ id ] . exportsData ??
718
+ extractExportsData ( src , config , ssr ) )
719
+ if ( exportsData . jsxLoader && ! esbuildOptions . loader ?. [ '.js' ] ) {
720
+ // Ensure that optimization won't fail by defaulting '.js' to the JSX parser.
721
+ // This is useful for packages such as Gatsby.
722
+ esbuildOptions . loader = {
723
+ '.js' : 'jsx' ,
724
+ ...esbuildOptions . loader ,
725
+ }
724
726
}
725
- }
726
- const flatId = flattenId ( id )
727
- flatIdDeps [ flatId ] = src
728
- idToExports [ id ] = exportsData
729
- flatIdToExports [ flatId ] = exportsData
730
- }
727
+ const flatId = flattenId ( id )
728
+ flatIdDeps [ flatId ] = src
729
+ idToExports [ id ] = exportsData
730
+ flatIdToExports [ flatId ] = exportsData
731
+ } ) ,
732
+ )
731
733
732
734
if ( optimizerContext . cancelled ) return { context : undefined , idToExports }
733
735
0 commit comments