im问题修复

This commit is contained in:
2026-06-02 17:25:45 +08:00
parent b475bee7ed
commit 370142a99f

View File

@@ -29,7 +29,10 @@ class ImClient {
if (typeof window !== 'undefined' && typeof window.commonEventFunc !== 'function') {
window.commonEventFunc = function () {}
}
this.sdk = getSDK({ coreWasmPath: '/openIM.wasm', debug: false })
// 用 BASE_URL 拼路径,部署到子目录时也能正确解析;线上 nginx 必须给 .wasm 配 application/wasm MIME
const base = (typeof process !== 'undefined' && process.env && process.env.BASE_URL) || '/'
const wasmUrl = base.replace(/\/?$/, '/') + 'openIM.wasm'
this.sdk = getSDK({ coreWasmPath: wasmUrl, debug: false })
this._wireEvents()
}