今天一开始部署都是成功的,好好的,突然给我整了个报错
Error: 'createElementVNode' is not exported by node_modules@vue\runtime-dom\dist\runtime-dom.esm-bundler.js, imported by src\components\Topnav.vue?vue&type=template&id=57512c07&lang.js
- 这对于作为小白的我来说真是手足无措,搜了半天找不到答案
- 后来经人指点,试了好几个版本,改了无数次 package.json 后 yarn install 就解决了,版本如下,记录一下
补充:发现改了package.json后再 rollup -c 就报错了
[!](plugin vue) TypeError: Cannot read property 'refSugar' of undefined
- 查了一下发现是这些个版本不能 rollup -c,要指定以下版本才可以
{
"name": "shiki-ui",
"version": "0.0.2",
"files": [
"dist/lib/*"
],
"main": "dist/lib/shiki.js",
"module": "dist/lib/shiki.esm.js",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"resolutions": {
"node-sass": "npm:sass@1.26.11"
},
"dependencies": {
"github-markdown-css": "4.0.0",
"marked": "1.1.1",
"prismjs": "1.21.0",
"vue": "3.0.0",
"vue-router": "4.0.0-beta.3"
},
"devDependencies": {
"@vue/compiler-sfc": "3.0.0",
"rollup-plugin-esbuild": "2.5.0",
"rollup-plugin-scss": "2.6.0",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-vue": "6.0.0-beta.10",
"sass": "1.32.11",
"vite": "1.0.0-rc.1"
}
}
解决方法(不完美)
- build 的时候用上面截图标出来的版本
- rollup -c 的时候用上面代码的版本
总结
- 版本问题导致的 build 失败和 rollup -c 失败,可能是我改代码过程中手贱改了什么其他东西