This PR resolves the issue where using paho-mqtt.js in an ESM project caused the error: Paho.Client is not a constructor. The root cause was that paho-mqtt.js is distributed as a UMD module, which is incompatible with native ESM imports.
To address this, the build process has been updated to include the @rollup/plugin-commonjs plugin. This plugin ensures that UMD modules like paho-mqtt.js are correctly transformed into ESM-compatible modules during the ESM build process.
This change allows MqttOverWS to use Paho.Client without any compatibility issues.
Issue #, if available
Description of how you validated changes
Imported the updated package into an ESM project.
Verified that the Paho.Client is not a constructor error no longer occurs during runtime.
Tested the MQTT connection functionality to ensure it works as expected with the MqttOverWS implementation.
Confirmed that the Rollup build process completes without errors and generates correct ESM-compatible output.
Description of changes
This PR resolves the issue where using
paho-mqtt.js
in an ESM project caused the error:Paho.Client is not a constructor
. The root cause was thatpaho-mqtt.js
is distributed as a UMD module, which is incompatible with native ESM imports.To address this, the build process has been updated to include the @rollup/plugin-commonjs plugin. This plugin ensures that UMD modules like
paho-mqtt.js
are correctly transformed into ESM-compatible modules during the ESM build process.This change allows
MqttOverWS
to usePaho.Client
without any compatibility issues.Issue #, if available
Description of how you validated changes
Paho.Client is not a constructor
error no longer occurs during runtime.MqttOverWS
implementation.Checklist
yarn test
passesChecklist for repo maintainers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.