rollup / rollup-plugin-commonjs

This module has moved and is now available at @rollup/plugin-commonjs / https://github.com/rollup/plugins/blob/master/packages/commonjs
MIT License
502 stars 126 forks source link

Error with readable-stream #293

Closed tobiastimm closed 4 years ago

tobiastimm commented 6 years ago

When I use readable-stream with the rollup-plugin-commonjs it throws:

TypeError: The super constructor to "inherits" must not be null or undefined
    at Object.inherits (util.js:969:11)
    at Object.<anonymous> (/home/ttimm/dev/workspaces/rollup-readable-stream/dist/index.js:1129:8)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

at runtime.

I've created a repo and tested it with babel & typescript.

https://github.com/TobiasTimm/rollup-typescript-readable-stream

westonpace commented 5 years ago

In case someone else stumbles into this issue. This isn't really a problem with rollup-plugin-commonjs and more just an issue between rollup not supporting all circular dependencies and readable-stream not removing the circular dependency because they are valid under the ES module spec. They both have issues tracking this:

https://github.com/rollup/rollup/issues/1507 https://github.com/nodejs/readable-stream/issues/348

There is workaround mentioned in the first issue by timdp which replaces readable-stream with stream and it works most of the time for me.

shellscape commented 4 years ago

Hey folks (this is a canned reply, but we mean it!). Thanks to everyone who participated in this issue. We're getting ready to move this plugin to a new home at https://github.com/rollup/plugins, and we have to do some spring cleaning of the issues to make that happen. We're going to close this one, but it doesn't mean that it's not still valid. We've got some time yet before the move while we resolve pending Pull Requests, so if this issue is still relevant, please @ me and I'll make sure it gets transferred to the new repo. :beer: