chore(web): 构建配置清理 —— 别名读 tsconfig、调高 chunk 警告阈值、删死掉的 browserslistrc
Deploy / deploy (push) Canceled after 0s

- resolve.alias 换成 resolve.tsconfigPaths,别名只在 tsconfig.app.json 写一份
- chunkSizeWarningLimit 调到 1000:超 500 kB 的三个 chunk(skulpt / wangeditor /
  @mermaid-js/parser)都是懒加载,默认阈值下每次构建都报,真涨了反而看不见
- 删 .browserslistrc(chrome >= 90):renderLegacyChunks 关着时 plugin-legacy 不读它,
  vite / oxc 也不读,留着只会和 105 的基线打架

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-09-27 16:15:05 +08:00
1 parent 9412ba3cf6
commit ca1df38440
3 files changed
+13 -8

No files matched your search

-1
View File
@@ -1 +0,0 @@
chrome >= 90
+3
View File
@@ -85,6 +85,9 @@ admin → ./src/admin
shared → ./src/shared
```
只在 `tsconfig.app.json` 的 `paths` 里写一份,`vite.config.ts` 用 `resolve.tsconfigPaths`
直接读它 —— 加别名只改 tsconfig。
### HTTP Client
`utils/api.ts` — Axios instance with interceptors (`baseURL: "/api"`,
+10 -7
View File
@@ -1,4 +1,3 @@
import { fileURLToPath, URL } from "node:url"
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import legacy from "@vitejs/plugin-legacy"
@@ -137,12 +136,16 @@ export default defineConfig(() => {
],
envPrefix: "PUBLIC_",
resolve: {
alias: {
utils: fileURLToPath(new URL("./src/utils", import.meta.url)),
oj: fileURLToPath(new URL("./src/oj", import.meta.url)),
admin: fileURLToPath(new URL("./src/admin", import.meta.url)),
shared: fileURLToPath(new URL("./src/shared", import.meta.url)),
},
// 别名(utils / oj / admin / shared)只在 tsconfig.app.json 的 paths 写一份,
// 这里直接读它。tsconfig.json 是 references 空壳也没关系,会顺着找过去(实测)
tsconfigPaths: true,
},
build: {
// 超过 500 kB 的三个 chunk 都是懒加载的:skulpt(Python 语法检查,产物名叫
// main-*.js,是 skulpt 自己入口的名字,不是应用入口)、wangeditor(后台富文本)、
// @mermaid-js/parser。默认阈值下这条警告每次构建都在报,真涨了反而没人看,
// 所以抬到比它们略高。首屏入口 index-*.js 在 175 kB 左右
chunkSizeWarningLimit: 1000,
},
server: {
port: 5173,