nodejs / readable-stream

Node-core streams for userland
https://nodejs.org/api/stream.html
Other
1.03k stars 227 forks source link

Question on old strange require string_decoder #481

Closed robertsLando closed 2 years ago

robertsLando commented 2 years ago

I was having issues using MQTT.js on browser with vite. It was throwing me an error that said he cannot found a module, I have investigated and I discovered this:

https://github.com/nodejs/readable-stream/blob/v3.6.0/lib/_stream_readable.js#L163

Manually changing 'string_decoder/' to 'string_decoder' fixed the issue

I know now it is fixed in v4.+ but wondering if that was a typo or it's just a sintax that webpack picks up correctly by stripping suffix / or whatelse?

@mcollina

mcollina commented 2 years ago

I would say it's better to use v4 if you want to bundle this. The architecture of bundlers changed significantly and v3 has not been kept up to date.