Closed AlbertoElias closed 6 years ago
so the issue there is that where it is being used in the code the thing is undefined, lemme dig into it in a bit
Great, thank you very much, let me know if you need any more information
ok so the actual issue is that not every module can be used with rollup even with plugins, specifically readable stream can't, so instead you need to either bundle simple-peer up with some other bundler or substitute the version of streams that this library provides somehow
Thanks for checking it out. Could you provide any more information as to why it doesn't work with rollup?
complex stuff commonjs specific related dependencies
Do you know of any solution that simple-peer
could apply to fix this issue?
I believe there is a plugin that allows you to substitute different modules in, which you could use to substitute stream in for readable stream
Ended up going with the solution mentioned in this issue: https://github.com/rollup/rollup-plugin-alias/issues/33
@AlbertoElias Hi, I am having a similar issue Object prototype may only be an Object or null: undefined
due to this line of my rollup bundle: ctor.prototype = Object.create(superCtor.prototype, {
particularly superCtor.prototype
is undefined instead of an Object or null.
What did you do in rollup-plugin-replace
to fix this issue? I would've thought the rollup globals & builtins plugin would fix this issue but it doesn't.
When compiling simple-peer, I've tried configuring rollup in different ways, but I can't get past an error in this line where
superCtor
isundefined
.This is a gist with the minimal use case where this error happens:
https://gist.github.com/AlbertoElias/2641c23cc8dc256b29bc4c018e1888fa
Not sure if I'm doing something wrong or if there's some clash with simple-peer's
inherits
dependency.