juliangruber / stream

Node.js streams in the browser
62 stars 33 forks source link

emitter module wrong reference? #5

Open KapilGahlot opened 6 years ago

KapilGahlot commented 6 years ago

Hi,

I see below require statement in your index.js and you have listed emitter-component as one of your dependencies. Should the below line require from emitter-component instead of emitter?

var Emitter = require('emitter');

Your module is a dependency of another module that one of my Meteor apps require. My app threw an error that Emitter is not an constructor but when I changed the require reference as mentioned above, the error got resolved. I am curious that I did not see a similar issue reported by anybody else so not sure how it is working for others?

Regards

juliangruber commented 6 years ago

Interesting. Hm, this module hasn't been updated in a while and I haven't used component in a while. Happy to accept any PR that fixes this

durdenx commented 6 years ago

I fixed the issue in #6

barbalex commented 1 year ago

I am getting this error when building using vite:

"emitter" is imported by "emitter?commonjs-external", but could not be resolved – treating it as an external dependency

Which then breaks preview and production 😢

Also:

PS C:\Users\alexa\capturing> npm why emitter-component
emitter-component@1.1.1
node_modules/emitter-component
  emitter-component@"^1.1.1" from stream@0.0.2
  node_modules/stream
    stream@"0.0.2" from the root project
barbalex commented 1 year ago

Please merge https://github.com/juliangruber/stream/pull/6, this is blocking our project.

barbalex commented 1 year ago

For any one else running into this: use path-package (https://www.npmjs.com/package/patch-package) to fix the import as done in https://github.com/juliangruber/stream/pull/6/files

lucasriondel commented 1 year ago

@barbalex thanks for the fix. saved my day !

lucasriondel commented 1 year ago

@barbalex i'm still having issues with this library when trying to bundle it with rollup :

 IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
                                                                   ^
TypeError: Cannot read properties of undefined (reading 'prototype')

Did you have the same issues at some point ? running node v18.16.0

barbalex commented 1 year ago

@lucasriondel no, can't remember having that issue. The project that had our issue is being rebuilt and this part has not been added yet. So I'm not quite up to date right now.

lucasriondel commented 1 year ago

@barbalex ok so just so you know, using this package on modern version of node is clearly not recommended. I was able to remove it completely and using the built-in stream package from node instead. Everything worked out of the box.

barbalex commented 1 year ago

@lucasriondel Our app is a web app. There is no node to use it's built-in stream. For a node app your solution makes a lot of sense.