同步 sgs-frontend-mobile 源码
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-27 11:26:01 +08:00
parent 575dca430f
commit 9ea1bfab71
181 changed files with 24395 additions and 5212 deletions

View File

@@ -24,6 +24,17 @@ pnpm type-check
pnpm build:h5
```
生产构建必须通过部署环境变量注入真实腾讯地图 Web KeyKey 不提交到仓库:
```powershell
$env:VITE_TENCENT_MAP_KEY = '<真实腾讯地图 Web Key>'
pnpm build:h5
Remove-Item Env:VITE_TENCENT_MAP_KEY
```
构建脚本会拒绝 Key 占位符、历史测试域名和旧 MinIO 地址;测试构建可使用
`pnpm build:test:h5`,该命令只允许保留地图 Key 占位符,不允许旧域名进入产物。
`pnpm build:h5` 会先执行 `uni build -p h5`,再执行 `scripts/copy-h5-nav-assets.cjs`,把 `static/nav-assets` 复制到 `dist/build/h5/static/nav-assets`
构建后重点检查:
@@ -95,6 +106,39 @@ location ^~ /static/nav-assets/ {
try_files $uri =404;
}
# Vite 产物文件名带内容 hash可以长时间缓存且不会污染新版本。
location ^~ /assets/ {
expires 365d;
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# SDK、Engine、讲解图片和音频使用带版本/日期的路径,缓存 30 天。
location = /engine/index.html {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
try_files $uri =404;
}
location ^~ /engine/ {
expires 30d;
add_header Cache-Control "public, max-age=2592000";
try_files $uri =404;
}
location ^~ /static/ {
expires 30d;
add_header Cache-Control "public, max-age=2592000";
try_files $uri =404;
}
# HTML 负责指向最新 hash 资源,必须及时重新验证。
location = /index.html {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
try_files $uri =404;
}
location / {
try_files $uri $uri/ /index.html;
}