Skip to content

Events API polyfilled badly? #16

Open
@bmz1

Description

@bmz1

Hey there,

I am using Snowpack to deal with dependencies. I am aware that Snowpack uses rollup-plugin-node-polyfills to polyfill Node built-in modules. I'd like to use a package called async-mqtt which relies on node built-in modules (events, stream, buffer). So I installed it with Snowpack, and polyfilled it with this plugin. However, I noticed that the polyfilling process did something strange. I got an error: Class extends value [object Object] is not a constructor or null

Now, this error applies for the following code: class Parser extends events. So I checked what is the value of events, and it turns out, that events is an object instead of a class:

var events = /*#__PURE__*/Object.freeze({
  __proto__: null,
  'default': EventEmitter,
  EventEmitter: EventEmitter
});

Obviously, you cannot extend a class from an object like this. How can I resolve this issue?
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions