'openBlock' is not exported by node_modul
es/@dcloudio/uni-mp-vue/dist/vue.runtime.
esm.js, imported by node_modules/@dcloudio/uni-h5/dist/uni-h5.es.js

- 发布:2023-02-15 20:38
- 更新:2025-03-28 11:46
- 阅读:4558
dev mp-weixin 出错,怎么处理呢
最佳回复

DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信
在使用 mp-weixin 时候如果报错 uni-h5 的提示,可能是下面几种原因
- 错误引入了 uni-h5 的包,全局搜索
dcloudio/
观察是否有导入 - 有用户使用了 custom-tab-bar 这个组件,这个组件是 h5 特有的,https://uniapp.dcloud.net.cn/component/custom-tab-bar.html#custom-tab-bar 规避这个组件名称,比如
components:{myTabBar: customTabBar}
如果不知道问题所在,可以备份 pages.json ,然后从零开始添加路由,定位出现问题的路径,然后进入页面逐一删除组件,锁定错误原因。通过这种方法可以快速定位问题。
考虑到此贴时间比较久,某些依赖名可能发生了变化,如果有类似问题,可以开新贴艾特我,并提供排查问题的过程。提供更多信息,有助于定位和解答你的问题。

检查一下页面中使用uni.xxx api的时候是不是被自动引入了 'import { uni } from @dcloudio/uni-h5' 语句。

豌豆 (作者)
使用npx @dcloudio/uvm 升级后出现这个问题。
之后,在gitee下载新模板后,重新把原pages复制到新模板中,再重新安装依赖后,还是出现这个问题。
如果是新模板,且默认内容。并不会出现这个问题

豌豆 (作者)
运行报错信息
'openBlock' is not exported by node_modules/
@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js
, imported by node_modules/@dcloudio/uni-h5/dist/uni-h5.es.js
at ../node_modules/@dcloudio/uni-h5/dist/uni-h5.es.js:1:79
1: import { withModifiers, createVNode, ge
tCurrentInstance, ref, defineComponent, open
Block, createElementBlock, provide, computed
, watch, onUnmounted, inject, onBeforeUnmoun
t, mergeProps, injectHook, reactive, onActiv
ated, onMounted, nextTick, onBeforeMount, wi
thDirectives, vShow, shallowRef, watchEffect
, isVNode, Fragment, markRaw, Comment, h, cr
eateTextVNode, createBlock, onBeforeActivate
, onBeforeDeactivate, renderList, onDeactiva
ted, createApp, Transition, effectScope, wit
hCtx, KeepAlive, resolveDynamicComponent, cr
eateElementVNode, normalizeStyle, renderSlot } from "vue";
^
2:
3: import { isString, extend, isArray, rem
ove, stringifyStyle, parseStringStyle, isPla
inObject, isFunction, capitalize, camelize,
hasOwn, isObject, toRawType, makeMap as make
Map$1, isPromise, hyphenate, invokeArrayFns as invokeArrayFns$1 } from "@vue/shared";

Diligent_UI - 【插件开发】【专治疑难杂症】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=193663(微信搜索飘逸科技UI小程序直接体验)】【骗子请绕道】问题咨询请加QQ群:120594820,代表作灵感实用工具小程序
有时候单词写错了,有时候会自动引入一个模块代码

附件中有demo运行报错。使用npm run dev:h5运行正常。
npm run dev:mp-weixin
node_modules/@dcloudio/uni-h5/dist/uni-h5.es.js (1:79): "openBlock" is not exported by "node_modules/@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js", imported by "node_modules/@dcloudio/uni-h5/dist/uni-h5.es.js".
at ../node_modules/@dcloudio/uni-h5/dist/uni-h5.es.js:1:79
1: import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent, openBlock, createElementBlock, provide...
2: import { isArray, isString, extend, remove, stringifyStyle, parseStringStyle, isPlainObject, isFunction, capitalize, ...
3: import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, Emitter, passive, resolveComponentInstance, normalizeStyles,...
用户2857909
专门注册账号来感谢大佬,我花了几个小时排查没找到问题,最后确认就是custom-tab-bar 的问题 改了名字立马好了。。太感谢了。
2025-07-18 22:14
DCloud_UNI_OttoJi
回复 用户2857909: 感谢反馈
2025-07-21 14:47