禁止报错

This commit is contained in:
hackrobot
2025-04-14 10:16:42 -05:00
parent 2a64f28846
commit 8a227785d1
5 changed files with 21 additions and 4 deletions

View File

@@ -27,7 +27,10 @@ const config = {
},
h5: {
// 默认会编译为 es5修改为 es2017 或更高
esnext: true,
webpackChain(chain) {
chain.output.filename("static/js/[name].[contenthash:8].js");
chain.output.chunkFilename("static/js/[name].[contenthash:8].js");
chain
@@ -54,6 +57,7 @@ const config = {
simplify: true, // 开启简化,提高性能
// 禁用对 async/await 的转换
target: "browser", // 或设置为适合目标环境的 ECMAScript 版本
disableOptimizations: true, // 禁用某些优化来避免处理 async/await
},
["**/*.js", "!node_modules/**"], // 避免对 node_modules 进行混淆
@@ -125,6 +129,10 @@ const config = {
},
// 允许特定域名访问
allowedHosts: ["nomadyt.com", "localhost", ".nomadyt.com"], // 允许所有 *.nomadyt.com 子域访问
// ⬇️ 关键配置:禁用 overlay 错误弹出
client: {
overlay: false,
},
},
htmlPluginOption: {
favicon: path.resolve(__dirname, "..", "src", "images", "youtube.ico"), // 同样处理 favicon 路径
@@ -135,7 +143,8 @@ const config = {
},
},
target: ["web", "browserslist:> 0.25%, not dead"],
// target: ["web", "browserslist:> 0.25%, not dead"],
target: ["web", "es2017"], // 关键点!
},
};