MQTT.js
MQTT.js copied to clipboard
Vite^2.6.4 + Vue^3.2.16 + TypeScript^4.4.3 Use error reporting
- step
- step
3.step
The console reported an error What do I need to do
same as you,and I use the "vite": "^2.8.0" "vue": "^3.2.25", without Typescript
文件已收到!谢谢!
I solved this proble with #1269
-
Use
import * as mqtt from 'mqtt/dist/mqtt.min';
-
Add
"skipLibCheck": true
to your tsconfig.json -
Create a shims-mqtt.d.ts with
declare module 'mqtt/dist/mqtt.min' {
import MQTT from 'mqtt'
export = MQTT
}
Not work use " "vite": "^2.9.5", "typescript": "^4.6.3", "vue": "^3.2.33"" . Any better idea?
我用#1269解决了这个问题
- 利用
import * as mqtt from 'mqtt/dist/mqtt.min';
- 添加
"skipLibCheck": true
到您的 tsconfig.json- 创建一个 shims-mqtt.d.ts
declare module 'mqtt/dist/mqtt.min' { import MQTT from 'mqtt' export = MQTT }
谢谢,我也遇到了同样的问题
文件已收到!谢谢!
I solved this proble with #1269
- Use
import * as mqtt from 'mqtt/dist/mqtt.min';
- Add
"skipLibCheck": true
to your tsconfig.json- Create a shims-mqtt.d.ts with
declare module 'mqtt/dist/mqtt.min' { import MQTT from 'mqtt' export = MQTT }
我用上边的代码解决后,又出现了新问题:
文件已收到!谢谢!
I solved this proble with #1269
- Use
import * as mqtt from 'mqtt/dist/mqtt.min';
- Add
"skipLibCheck": true
to your tsconfig.json- Create a shims-mqtt.d.ts with
declare module 'mqtt/dist/mqtt.min' { import MQTT from 'mqtt' export = MQTT }
我用上边的代码解决后,又出现了新问题:
我又尝试了如下办法解决了这个问题:
- mqtt 版本降低为 4.0.1
- 引用改为
import mqtt from "mqtt/dist/mqtt.min"
;
文件已收到!谢谢!
MQTT 5.0.0 BETA is now available! Try it out and give us feedback: npm i mqtt@beta
. It may fix your issues
文件已收到!谢谢!