File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -150,3 +150,27 @@ const conn = new WebIM.connection({
150150 useOwnUploadFun: true // 是否使用自己的上传方式(如将图片文件等上传到自己的服务器,构建消息时只传 URL)
151151});
152152```
153+ ### 特别注意事项(uni-app Vue3 模式)
154+
155+ uni-app 在 ** Vue3 模式** 下,HBuilderX 会默认开启 [ ** 摇树优化(tree-shaking)** ] ( https://uniapp.dcloud.net.cn/collocation/manifest.html#treeshaking ) 。
156+ 该优化会在点击发行至` 网站-PC Web或手机H5 ` 后出现误删除环信 SDK 中未被显式引用的模块,导致发行后出现登录失败等异常情况。
157+
158+ #### 解决方案任选其一
159+ ** 方案一:手动关闭摇树优化(推荐)**
160+ 1 . 在 HBuilderX 顶部菜单打开 ` manifest.json ` → ** Web 配置** (H5 配置)。
161+ 2 . 找到 ** “发行时启用摇树优化(自动裁剪没有使用的组件和 API 库)”** 。
162+ 3 . 先 ** 勾选** ,再 ** 取消勾选** ,随后点击 ** 重新发行** 。
163+ 该操作会强制 HBuilderX 重新生成编译缓存,关闭摇树优化。
164+
165+ ** 方案二:手动配置关闭摇树优化**
166+ 在 ` manifest.json ` → 源码视图 → H5 节点下增加以下配置,然后重新编译即可:
167+
168+ ``` json
169+ "h5" : {
170+ "optimization" : {
171+ "treeShaking" : {
172+ "enable" : false
173+ }
174+ }
175+ }
176+ ```
You can’t perform that action at this time.
0 commit comments