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:
@@ -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.38(package.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 兼容,无需改业务代码
|
||||
- 注意:若日后升级 nuxt(3.13+ 自带 vue 3.5),可再升回 md-editor-v3 5.x
|
||||
@@ -46,7 +46,7 @@
|
||||
<template #header>
|
||||
<div class="text-lg font-medium flex items-center justify-between cursor-text">
|
||||
<el-space class="text-xl text-green-600 font-bold"><el-icon><Finished /></el-icon>教学教研</el-space>
|
||||
<nuxt-link :to="`/article/4159.html`" class="font-normal text-sm text-gray-400 flex items-center cursor-pointer">查看更多<el-icon><ArrowRight /></el-icon></nuxt-link>
|
||||
<nuxt-link :to="`/article/4161.html`" class="font-normal text-sm text-gray-400 flex items-center cursor-pointer">查看更多<el-icon><ArrowRight /></el-icon></nuxt-link>
|
||||
</div>
|
||||
</template>
|
||||
<div class="px-5">
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"js-md5": "^0.7.3",
|
||||
"less": "^4.1.3",
|
||||
"md-editor-v3": "^5.2.2",
|
||||
"md-editor-v3": "4.21.3",
|
||||
"nuxt": "^3.12.4",
|
||||
"qrcode": "^1.5.4",
|
||||
"qrcode.vue": "^3.3.3",
|
||||
|
||||
Generated
+619
-1007
File diff suppressed because it is too large
Load Diff
+100
@@ -0,0 +1,100 @@
|
||||
Arguments:
|
||||
/Users/gxwebsoft/nvm/versions/node/v22.13.1/bin/node /Users/gxwebsoft/.yarn/bin/yarn.js
|
||||
|
||||
PATH:
|
||||
/Users/gxwebsoft/.workbuddy/bin:/Users/gxwebsoft/.codebuddy/bin:/Users/gxwebsoft/.npm-global/bin:/Users/gxwebsoft/.codebuddy/bin:/Users/gxwebsoft/.npm-global/bin:/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin:/Users/gxwebsoft/nvm/versions/node/v22.13.1/bin:/Users/gxwebsoft/.yarn/bin:/Users/gxwebsoft/.config/yarn/global/node_modules/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.13/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/opt/homebrew/bin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/gxwebsoft/.workbuddy/bin:/Users/gxwebsoft/.codebuddy/bin:/Users/gxwebsoft/.npm-global/bin:/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin:/Users/gxwebsoft/nvm/versions/node/v22.13.1/bin:/Users/gxwebsoft/.yarn/bin:/Users/gxwebsoft/.config/yarn/global/node_modules/.bin:/Users/gxwebsoft/.openclaw/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.13/bin:/Users/gxwebsoft/Library/Application Support/JetBrains/Toolbox/scripts:/Users/gxwebsoft/.local/bin:/Users/gxwebsoft/go/bin:/Users/gxwebsoft/VUE/template-10490/node_modules/.bin:/Users/gxwebsoft/Library/Application Support/JetBrains/Toolbox/scripts:/Users/gxwebsoft/.local/bin:/Users/gxwebsoft/go/bin
|
||||
|
||||
Yarn version:
|
||||
1.22.17
|
||||
|
||||
Node version:
|
||||
22.13.1
|
||||
|
||||
Platform:
|
||||
darwin arm64
|
||||
|
||||
Trace:
|
||||
Error: EINVAL: invalid argument, mkdir '/Users/gxwebsoft/VUE/template-10490/node_modules/@element-plus/nuxt/node_modules'
|
||||
|
||||
npm manifest:
|
||||
{
|
||||
"name": "nuxt-app",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "nuxt build --dotenv .env.production",
|
||||
"dev": "nuxt dev --dotenv .env.development",
|
||||
"generate": "nuxt generate",
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare",
|
||||
"lint:js": "eslint --ext \".ts,.vue\" --ignore-path .gitignore .",
|
||||
"lint:prettier": "prettier --check .",
|
||||
"lint": "yarn lint:js && yarn lint:prettier",
|
||||
"lintfix": "prettier --write --list-different . && yarn lint:js --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/colors": "^6.0.0",
|
||||
"@ant-design/icons-vue": "^6.1.0",
|
||||
"@antv/g2": "^5.1.22",
|
||||
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
||||
"@typescript-eslint/parser": "^7.1.1",
|
||||
"ant-design-vue": "^3.2.11",
|
||||
"aos": "^2.3.4",
|
||||
"axios": "^1.7.4",
|
||||
"dayjs": "^1.11.5",
|
||||
"dayjs-nuxt": "^1.1.2",
|
||||
"element-plus": "^2.2.28",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"js-md5": "^0.7.3",
|
||||
"less": "^4.1.3",
|
||||
"md-editor-v3": "^5.2.2",
|
||||
"nuxt": "^3.12.4",
|
||||
"qrcode": "^1.5.4",
|
||||
"qrcode.vue": "^3.3.3",
|
||||
"sass": "^1.57.1",
|
||||
"swiper": "^11.1.15",
|
||||
"uuid": "^10.0.0",
|
||||
"vue": "latest",
|
||||
"vue-i18n": "^9.14.0",
|
||||
"vue-qrcode": "^2.2.2",
|
||||
"vue-router": "^4.1.5",
|
||||
"xgplayer": "^3.0.5",
|
||||
"xgplayer-mp4": "^3.0.5"
|
||||
},
|
||||
"packageManager": "pnpm@9.3.0+sha512.ee7b93e0c2bd11409c6424f92b866f31d3ea1bef5fbe47d3c7500cdc3c9668833d2e55681ad66df5b640c61fa9dc25d546efa54d76d7f8bf54b13614ac293631",
|
||||
"devDependencies": {
|
||||
"@element-plus/nuxt": "^1.0.9",
|
||||
"@nuxt/devtools": "^0.6.1",
|
||||
"@nuxt/image": "^1.7.0",
|
||||
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
||||
"@nuxtjs/i18n": "^8.5.2",
|
||||
"@types/aos": "^3.0.7",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@typescript-eslint/parser": "^7.1.1",
|
||||
"@unocss/nuxt": "^0.62.2",
|
||||
"@unocss/preset-attributify": "^0.62.2",
|
||||
"@unocss/preset-icons": "^0.62.2",
|
||||
"@unocss/preset-uno": "^0.62.2",
|
||||
"@vitejs/plugin-legacy": "^2.0.1",
|
||||
"@vitejs/plugin-vue": "^3.0.3",
|
||||
"dayjs-nuxt": "^1.1.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"nuxt": "^3.6.5",
|
||||
"prettier": "^3.2.5",
|
||||
"sass-embedded": "^1.77.8",
|
||||
"typescript": "^5.3.3",
|
||||
"unocss": "^0.62.2",
|
||||
"vite": "^3.0.9",
|
||||
"vite-plugin-compression": "^0.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
yarn manifest:
|
||||
No manifest
|
||||
|
||||
Lockfile:
|
||||
No lockfile
|
||||
Reference in New Issue
Block a user