build: 前端改用 Bun + Vite,格式化改用 bun fmt

- 包管理和运行时换成 Bun:bun.lock 取代 package-lock.json,脚本用 bun --bun 运行,
  CI 改用 oven-sh/setup-bun(1.4.4,与后端镜像一致)
- 构建工具从 Rsbuild 换成 Vite 8,沿用 PUBLIC_ 环境变量前缀和 3000 端口;
  浏览器目标保持 Chrome 87 起(机房是 Chrome 105),用 plugin-legacy 按需注入
  core-js(toSorted 等),不生成旧浏览器的兼容包
- fmt 改用 Bun 自带的格式化,配置从 .prettierrc.toml 移到 bunfig.toml;
  prettier 包仍保留,编辑器里的「整理」按钮在浏览器里用它

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-26 19:10:50 +08:00
1 parent 351e4b9499
commit dde976cacb
13 files changed
+932 -3388

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import { defineConfig, loadEnv } from "vite"
import vue from "@vitejs/plugin-vue"
import legacy from "@vitejs/plugin-legacy"
import Components from "unplugin-vue-components/vite"
import { NaiveUiResolver } from "unplugin-vue-components/resolvers"
// 与原来 Rsbuild 默认的浏览器范围一致;机房电脑是 Chrome 105
const targets = ["chrome >= 87", "edge >= 88", "firefox >= 78", "safari >= 14"]
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "PUBLIC_")
return {
plugins: [
vue(),
Components({ resolvers: [NaiveUiResolver()] }),
// 只按需注入 core-js(toSorted 等新 API),不生成给不支持 ES 模块的旧浏览器用的包
legacy({ modernTargets: targets, modernPolyfills: true, renderLegacyChunks: false }),
],
// 沿用 Rsbuild 时期的 PUBLIC_ 前缀
envPrefix: "PUBLIC_",
server: {
port: 3000,
proxy: {
"/media": {
target: env.PUBLIC_WEB_URL,
changeOrigin: true,
},
"/ws": {
target: env.PUBLIC_WEB_URL,
ws: true,
changeOrigin: true,
},
},
},
}
})