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

fix: add missing export of UniqueMessageIdProvider and DefaultMessageIdProvider #1572

Conversation

ogis-ksuzuki
Copy link
Contributor

I tried to build the source code using the UniqueMessageIdProvider with webpack, but it could not be called correctly.

for example)

import * as mqtt from 'mqtt';
let provider = new mqtt.UniqueMessageIdProvider();

The reason is that in the webpack build, "browser" field of package.json "./mqtt.js": "./lib/connect/index.js" causes the entry point to be "./lib/connect/index.js" and that "index.js" does not contain an export of UniqueMessageIdProvider.

In case of node build, './mqtt.js' is referenced and 'mqtt.js' exports UniqueMessageIdProvider.
Same for DefaultMessageIdProvider.

I added a DefaultMessageIdProvider and UniqueMessageIdProvider export to "index.js" and confirmed that the issue was resolved and the unit tests passed.

ogis-yamazaki added a commit to ogis-yamazaki/MQTT.js that referenced this pull request Jan 23, 2023
@robertsLando
Copy link
Member

@ogis-ksuzuki Could you fix conflicts please?

@ogis-ksuzuki
Copy link
Contributor Author

@robertsLando Resolved merge conflict.

@robertsLando robertsLando changed the title fix: Build with webpack does not include UniqueMessageIdProvider fix: add missing export of UniqueMessageIdProvider and DefaultMessageIdProvider Jun 27, 2023
@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.04 🎉

Comparison is base (9e3d8a3) 86.18% compared to head (2baaf32) 86.22%.

❗ Current head 2baaf32 differs from pull request most recent head f496481. Consider uploading reports for the commit f496481 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1572      +/-   ##
==========================================
+ Coverage   86.18%   86.22%   +0.04%     
==========================================
  Files          13       13              
  Lines        1310     1314       +4     
==========================================
+ Hits         1129     1133       +4     
  Misses        181      181              
Impacted Files Coverage Δ
lib/connect/index.js 89.53% <100.00%> (+0.51%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@robertsLando robertsLando merged commit aa2e0ad into mqttjs:main Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants