Skip to content

Commit 472ed6c

Browse files
committed
build: webpack es2022
1 parent 5e8eb7f commit 472ed6c

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

webpack/webpack.common.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,26 @@ const prodPublicPath = normalizePublicPath(
109109
)
110110

111111
const 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+
/The generated code contains 'async\/await' because this module is using "external script"\.[\s\S]*your target environment does not appear to support 'async\/await'\./,
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
{

0 commit comments

Comments
 (0)