FredKSchott / rollup-plugin-polyfill-node

A modern Node.js polyfill for your Rollup bundle.
Other
177 stars 57 forks source link

EventEmitter polyfill export disallows extension #6

Open dmotz opened 3 years ago

dmotz commented 3 years ago

When I run snowpack dev --polyfill-node, I get an error for a class extending the events polyfill:

TypeError: Class extends value [object Object] is not a constructor or null

Snowpack is outputting this:

class Foo extends polyfillNode_events {

But polyfillNode_events is not a function and looks like this:

{
  EventEmitter: ƒ EventEmitter()
  default: ƒ EventEmitter()
}

I'm not sure if Snowpack should be handling this by outputting polyfillNode_events.default or the exports in this package should be changed.

adgang commented 3 years ago

Is somebody working on this? @dmotz Do you have a workaround for the issue?

dmotz commented 3 years ago

@adgang Unfortunately no. I ended up switching to a different library that didn't need EventEmitter to avoid having to change my bundler setup.