ionic-team / ionic-team/rollup-plugin-node-polyfills

Events API polyfilled badly?

Aperta
#16 1 commento 7 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
142
Fork
65
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.