Skip to content

[Bug]: Uniapp subpackage cannot use local mqtt.js file #1994

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

Open
kerwin58 opened this issue May 8, 2025 · 1 comment
Open

[Bug]: Uniapp subpackage cannot use local mqtt.js file #1994

kerwin58 opened this issue May 8, 2025 · 1 comment
Labels

Comments

@kerwin58
Copy link

kerwin58 commented May 8, 2025

MQTTjs Version

v4.2.1

Broker

EMQX

Environment

NodeJS

Description

Unable to reference the methods in mqtt.js

Minimal Reproduction

Image

import * as mqtt from './mqtt.js'
mqttData.client = mqtt.connect(
      hosts,
      mqttData.options
  );

Image

Debug logs

detail.vue:494 Uncaught (in promise) TypeError: mqtt.connect is not a function
at Proxy.connect (detail.vue:494:30)
at getInfo (detail.vue:880:12)

@kerwin58 kerwin58 added the bug label May 8, 2025
@robertsLando
Copy link
Member

@kerwin58 try with import mqtt from 'mqtt'

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

No branches or pull requests

2 participants