File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,12 +109,26 @@ const prodPublicPath = normalizePublicPath(
109109)
110110
111111const config = {
112+ // Module Federation 的 remote script loader 可能生成 async/await。
113+ // 明确目标环境为现代浏览器(2026年 ES2022 已被所有主流浏览器完全支持)。
114+ target : [ 'web' , 'es2022' ] ,
112115 entry : {
113116 app : paths . entry ,
114117 } ,
118+ ignoreWarnings : isMfeEnabled
119+ ? [
120+ {
121+ message :
122+ / T h e g e n e r a t e d c o d e c o n t a i n s ' a s y n c \/ a w a i t ' b e c a u s e t h i s m o d u l e i s u s i n g " e x t e r n a l s c r i p t " \. [ \s \S ] * y o u r t a r g e t e n v i r o n m e n t d o e s n o t a p p e a r t o s u p p o r t ' a s y n c \/ a w a i t ' \. / ,
123+ } ,
124+ ]
125+ : [ ] ,
115126 output : {
116127 path : paths . build ,
117128 publicPath : isMfeEnabled ? 'auto' : isDev ? '/' : prodPublicPath ,
129+ environment : {
130+ asyncFunction : true ,
131+ } ,
118132 uniqueName : isMfeEnabled ? toMfeName ( paths . projectName ) : undefined ,
119133 filename : isDev ? 'static/js/[name].js' : 'static/js/[name].[contenthash].js' ,
120134 chunkFilename : isDev ? 'static/js/[name].js' : 'static/js/[name].[contenthash].js' ,
@@ -303,7 +317,7 @@ const config = {
303317 loader : 'esbuild-loader' ,
304318 options : {
305319 // loader: 'tsx',
306- target : 'es2020 ' ,
320+ target : 'es2022 ' ,
307321 } ,
308322 } ,
309323 {
You can’t perform that action at this time.
0 commit comments