From 9c2664289630cc02d177ef1c0f1a8d5e92eec26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Wed, 7 Oct 2026 13:49:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=B6=E6=B3=A5=E5=84=BF=20H5=20=E4=BA=A7?= =?UTF-8?q?=E7=89=A9=E6=A0=A1=E9=AA=8C=E8=A6=86=E7=9B=96=E5=8D=95=E5=BC=95?= =?UTF-8?q?=E5=8F=B7=E6=A0=B9=E8=B7=AF=E5=BE=84=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - assertH5Root 的属性正则同时匹配单/双引号并容忍 = 两侧空白,避免手写/插件 HTML 漏检 --- .../vite-export-taonier/scripts/vite.config.taonier.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/src-tauri/resources/agc-skills/vite-export-taonier/scripts/vite.config.taonier.mjs b/apps/ai-game-creator-shell/src-tauri/resources/agc-skills/vite-export-taonier/scripts/vite.config.taonier.mjs index 8bf48ba19..23a3e450f 100644 --- a/apps/ai-game-creator-shell/src-tauri/resources/agc-skills/vite-export-taonier/scripts/vite.config.taonier.mjs +++ b/apps/ai-game-creator-shell/src-tauri/resources/agc-skills/vite-export-taonier/scripts/vite.config.taonier.mjs @@ -52,7 +52,11 @@ export function assertH5Root(outDir) { } const html = readFileSync(htmlPath, 'utf8'); - const absoluteRefs = [...html.matchAll(/\s(?:src|href)="(\/[^"]*)"/gi)].map((match) => match[1]); + // 同时匹配单/双引号属性,且容忍 `=` 两侧空白;只看双引号会漏掉手写 HTML 或插件产物里的 + // `src='/app.js'`,让误配 base 的产物通过校验、上传后整站 404。 + const absoluteRefs = [...html.matchAll(/\s(?:src|href)\s*=\s*(["'])(\/[^"']*)\1/gi)].map( + (match) => match[2], + ); if (absoluteRefs.length > 0) { throw new Error( `index.html 仍引用根路径资源(${absoluteRefs.join(', ')});`