fix(build): 降级 md-editor-v3 解决构建失败问题

- md-editor-v3 5.x 依赖 Vue 3.5+ 的 useId API,与项目中 Vue 3.4.38 版本不兼容
- 将 package.json 中 md-editor-v3 版本由 ^5.2.2 修改为精确版本 4.21.3,确保兼容 Vue 3.2+
- pnpm install 后重新构建成功,修复 nuxt build 报错
- 保持业务代码兼容,不需改动现有使用 MdEditor 的组件
- 备注:待 nuxt 升级至 3.13+(内置 Vue 3.5)时,可恢复 md-editor-v3 5.x 版本
- 同时更新 ZSNews 组件中“查看更多”链接地址,调整为正确的文章路径 /article/4161.html
This commit is contained in:
2026-08-24 11:15:27 +08:00
parent a8e231746f
commit 276866a8c5
6 changed files with 730 additions and 1009 deletions
+9
View File
@@ -0,0 +1,9 @@
# 2026-08-24
## 修复 template-10490 打包失败(md-editor-v3 与 vue 版本不兼容)
- 现象:`nuxt build``"useId" is not exported by .../md-editor-v3/lib/es/chunks/index3.mjs`
- 根因:md-editor-v3@5.x 全系列(5.0.0 起)依赖 Vue 3.5+ 的 `useId` API,而项目 vue 被 nuxt@3.12.4 锁在 3.4.38package.json 写 `vue: latest` 也无效,pnpm 按 nuxt 的依赖范围解析)
- 修复:package.json 中 `md-editor-v3``^5.2.2` 改为精确版本 `4.21.3`4.x 最新,peer 要求 vue ^3.2.47),pnpm install 后 build 成功
- 项目仅用 MdEditor / MdPreview 标准组件(pages/developer/[id].vue、pages/ask/add.vue、pages/market/[id].vue、components/Content.vue),4.x API 兼容,无需改业务代码
- 注意:若日后升级 nuxt3.13+ 自带 vue 3.5),可再升回 md-editor-v3 5.x