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