Closed MackJac closed 2 years ago
发测试工程
serve.js
顶部补充 require('module-alias/register')
package.json
中增加 module-alias
依赖以及
"_moduleAliases": {
"vue": "node_modules/@dcloudio/uni-h5-vue",
"vue/server-renderer": "node_modules/@vue/server-renderer"
},
问题描述 使用uniapp vue3 vite项目构建build:h5:ssr后,npm run serve调试可运行,但是跳转页面报错TypeError: Cannot read properties of null (reading 'insertBefore')
复现步骤 [复现问题的步骤]
实际结果 TypeError: Cannot read properties of null (reading 'insertBefore')
补充信息 查看@dcloudio/uni-h5有以下代码,不知道是否因为这个 insertBefore(blot, ref2) { if (blot instanceof ListItem) { super.insertBefore(blot, ref2); } else { const index2 = ref2 == null ? this.length() : ref2.offset(this); const after = this.split(index2); after.parent.insertBefore(blot, after); } }