MQTT.js
MQTT.js copied to clipboard
In the WeChat mini program, the IDE throw error
When developing a project with WeChat mini program, I want to import the MQTT , but I found that the WeChat mini program's IDE throw error
MQTT version: 5.0.5
if I use v4.2.1,it will work well
what's the content of './lib/mqtt'
?
god! me too! why every version not work in WeChat mini program!! goddamn!
what's the content of
'./lib/mqtt'
?
This is the file for the dist directory after build it.
Because WeChatmini programs do not support import by npm, so only be import by source file, like import mqtt from "mqtt/dist/mqtt.min.js"
god! me too! why every version not work in WeChat mini program!! goddamn!
version 4.2.1 will work that import by bundle file
what's the content of
'./lib/mqtt'
?
In addition, from v4.2.2 to 4.3.7,after reading the source code, I found that it misjudged the environment of wechat and mistaken it for node
@worldsoon refer it : https://github.com/xuhongv/WeChatAirkiss
I found that it misjudged the environment of wechat and mistaken it for node
Would you like to submit a PR to fix this? Maybe the error comes from: https://github.com/mqttjs/MQTT.js/blob/main/src/lib/is-browser.ts
Try with 5.3.6