Skip to content

Class this is set to super() instance #5062

@robertsLando

Description

@robertsLando

Rollup Version

3.26.2

Operating System (or Browser)

Linux

Node Version (if applicable)

20.0.0

Link To Reproduction

mqttjs/MQTT.js#1632

To reproduce checkout the PR branch then run:

npm install
npm run unit-test:browser

Expected Behaviour

I expect the output boundle to work.

Seems that rollup output boundle makes some strange tweaks on mqtt-packet. In that line this.constructor is null as this points to EventEmitter, not Parser instance.

Couldn't find anything to fix this issue, I just found a possible reference to it here: vitejs/vite#9703 but it doesn't solve the issue

Actual Behaviour

when executed it throws:

TypeError: (intermediate value).parser is not a function\n' +
      '    at Object.parser (http://localhost:41649/airtap/test.js:21721:59)\n' +
      '    at MqttClient._setupStream (http://localhost:41649/airtap/test.js:24589:32)\n' +
      '    at new MqttClient (http://localhost:41649/airtap/test.js:24578:11)\n' +
      '    at Object.connect (http://localhost:41649/airtap/test.js:31530:19)\n' +
      '    at /MQTT.js/test/browser/test.js.../../dist/mqtt (http://localhost:41649/airtap/test.js:44620:21)\n' +
      '    at o (http://localhost:41649/airtap/test.js:1:265)\n' +
      '    at r (http://localhost:41649/airtap/test.js:1:431)\n' +
      '    at http://localhost:41649/airtap/test.js:1:460'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions