Skip to content

chore(frontend):联合升级 vite 8 / plugin-react 6 / TypeScript 7 / Tailwind 4(替代 #60 #61 #64 #65) - #69

Merged
alloevil merged 1 commit into
masterfrom
deps/frontend-major-migration
Oct 18, 2026
Merged

alloevil merged 1 commit into
masterfrom
deps/frontend-major-migration

Conversation

@alloevil

Copy link
Copy Markdown
Owner

为什么要联合升级

4 个 Dependabot 大版本 PR 单独都过不了,原因各不相同(日志来自各 PR 的 test job):

PR 升级 单独失败的原因
#60 vite 6.4.3 → 8.3.1 ERESOLVE:@vitejs/plugin-react@4.7.0 的 peer 是 vite ^4…^7
#64 @vitejs/plugin-react 4.7.0 → 6.1.1 ERESOLVE:plugin-react@6.1.1 的 peer 是 vite ^8.0.0
#61 typescript 5.7.3 → 7.0.2 tsconfig.app.json(23,5): error TS5102: Option 'baseUrl' has been removed
#65 tailwindcss 3.4.19 → 4.3.3 [vite:css] [postcss] It looks like you're trying to use tailwindcss directly as a PostCSS plugin…

#60 和 #64 互相依赖,必须一起合;#61、#65 需要改配置。

改动(只动 frontend/ 和一行注释)

  • vite ^8.3.4、@vitejs/plugin-react ^6.1.2、typescript ~7.0.2、tailwindcss ^4.3.3。
  • Tailwind 4:用官方 @tailwindcss/upgrade@4.3.3 迁移:postcss.config.js 改用 @tailwindcss/postcss;删掉 tailwind.config.js,主题改成 src/index.css 里的 @import 'tailwindcss' + @theme;tailwindcss-animate 改为 @plugin;移除 autoprefixer(v4 内置);28 个文件里的 v4 工具类改名(shadow-sm→shadow-xs、outline-none→outline-hidden 等)。codemod 把 Button 的 variant 'outline' 误改成了 'outline-solid'(TS2322),已手动改回。components.json 的 tailwind.config 置空(v4 的 shadcn 写法)。
  • TypeScript 7:去掉 tsconfig.json / tsconfig.app.json 里的 baseUrl,paths 仍是 ./src/*(相对 tsconfig 解析)。
  • vite 8 不再依赖 esbuild,而 scripts/build-legacy-pure.mjs 要从 frontend/ 解析 esbuild 生成 public/js/pure.js,所以把 esbuild ^0.28 加成 frontend 的显式 devDependency。

本地验证(Node 22.23.3,与 CI 同版本)

  • 根目录 npm ci(prepare 会完整构建 UI):✓ built in 1.18s
  • git diff --exit-code public/js/pure.js lib/generated/diagnostics.cjs:无漂移
  • npx biome check .:exit 0(91 warnings / 159 infos,和 master 一致)
  • npm test:# tests 348 · # pass 348 · # fail 0
  • verify-claims:16 machine-checked · 16 ok · 0 failed · 0 error · 3 manual
  • demo 构建(VITE_DEMO=1)和 master 截图对比:布局、配色一致,只有几像素的行距差别。

合并后可以关掉的 Dependabot PR

#60、#61、#64、#65(本 PR 不自动关闭它们,等你确认后再处理)。dependabot.yml 不需要改:四个升级都迁移成功了。

…, TypeScript 7, Tailwind CSS 4

Supersedes Dependabot #60 (vite 8.3.1), #61 (typescript 7.0.2), #64 (@vitejs/plugin-react 6.1.1)
and #65 (tailwindcss 4.3.3). They fail one by one because they depend on each other or need
config changes:
- #60/#64: plugin-react 4 peers vite<=7 and plugin-react 6 peers vite>=8 (npm ERESOLVE), so
  they must land together.
- #61: TypeScript 7 removed compilerOptions.baseUrl (TS5102); paths now resolve relative to
  the tsconfig, so baseUrl is dropped and paths keep './src/*'.
- #65: Tailwind 4 moved the PostCSS plugin to @tailwindcss/postcss. Migrated with the official
  @tailwindcss/upgrade 4.3.3: CSS-first @theme in src/index.css replaces tailwind.config.js,
  tailwindcss-animate via @plugin, autoprefixer removed (built in), v4 utility renames in
  28 files. One codemod mistake fixed by hand: the Button variant prop 'outline' had been
  rewritten to 'outline-solid' (TS2322).
- vite 8 no longer depends on esbuild, which scripts/build-legacy-pure.mjs resolves from
  frontend/; esbuild ^0.28 is now an explicit frontend devDependency.

Local (Node 22.23.3, the CI version): npm ci + build OK, pure.js/diagnostics.cjs no drift,
biome check exit 0 (91 warnings / 159 infos, same as master), npm test 348/348,
verify-claims 16 machine-checked · 16 ok · 0 error · 3 manual.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant