Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite^2.6.4 + Vue^3.2.16 + TypeScript^4.4.3 Use error reporting #1448

Closed
sunjunjie1314520 opened this issue Mar 14, 2022 · 12 comments
Closed

Comments

@sunjunjie1314520
Copy link

  1. step
    image
  2. step
    image
    3.step
    image
    The console reported an error
    What do I need to do
@nanxfu
Copy link

nanxfu commented Mar 19, 2022

same as you,and I use the "vite": "^2.8.0" "vue": "^3.2.25", without Typescript

@sunjunjie1314520
Copy link
Author

sunjunjie1314520 commented Mar 19, 2022 via email

@nanxfu
Copy link

nanxfu commented Mar 19, 2022

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
}

@kkstun
Copy link

kkstun commented Apr 25, 2022

Not work use " "vite": "^2.9.5", "typescript": "^4.6.3", "vue": "^3.2.33"" . Any better idea?

@BoBoDinachen
Copy link

我用#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
}

谢谢,我也遇到了同样的问题

@sunjunjie1314520
Copy link
Author

sunjunjie1314520 commented Aug 12, 2022 via email

@Calerme
Copy link

Calerme commented Sep 24, 2022

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
}

我用上边的代码解决后,又出现了新问题:

image

@sunjunjie1314520
Copy link
Author

sunjunjie1314520 commented Sep 24, 2022 via email

@Calerme
Copy link

Calerme commented Sep 24, 2022

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
}

我用上边的代码解决后,又出现了新问题:

image

我又尝试了如下办法解决了这个问题:

  1. mqtt 版本降低为 4.0.1
  2. 引用改为 import mqtt from "mqtt/dist/mqtt.min";

@sunjunjie1314520
Copy link
Author

sunjunjie1314520 commented Oct 11, 2022 via email

@robertsLando
Copy link
Member

MQTT 5.0.0 BETA is now available! Try it out and give us feedback: npm i mqtt@beta. It may fix your issues

@sunjunjie1314520
Copy link
Author

sunjunjie1314520 commented Jul 21, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants