Open barakbbn opened 4 years ago
Hi, "stream" is built-in part of the Node.js standard library (not an external package): https://nodejs.org/api/stream.html
It is dynamically imported when needed (only when a particular method is called and when running in the Node.js environment).
I see WebPack is trying to resolve that dependency. I'm not quite familiar with WebPack to give advice on how to work around that. A quick search lead to this issue on the tracker. One of the comments links to this solution to ignore a module in a particular environment. I'm not sure yet if it would help putting it in the package.json
of the published library itself. Need to explore further.
npm install stream resolved the issue, however, this step should not be needed..
Same here
I think my PR might address this issue too. It adds a dependency to 'readable-stream' (which is more compatible) and also instructs npm/yarn to install with package. https://github.com/rotemdan/lzutf8.js/pull/30
Thanks for the PR. I'm still a bit confused why referencing node's own stream
module has become so problematic. I guess that back when the library was initially written (2014) it was mostly about supporting either the browser or the Node environments. Today there's all sort of wrappers and libraries that attempt to emulate some of each's features, causing compatibility issues.
I'll merge the pull request and see what needs to be done from there.
Latest PR breaks for any applications that use rollup to bundle, see: https://github.com/nodejs/readable-stream/issues/348
@ispyinternet
I have published the PR to a minor version (0.5.8
). This may have been a mistake since adding the new dependency could be seen as a breaking change. I've now published version 0.6.0
with a minor unrelated change.
I'm considering unpublishing 0.5.8
(to at least ensure that rollup users would get a broken minor update) but I'm not sure if that's a good idea.
Sorry about my month-late response. I have been busy lately.
The build is not browser compatible, but the readme file provides the browser option which makes it confusing.
readable-stream@4.4.0 causes Angular build to break (at least on AWS CodeBuild), we found a stopgap fix of pinning it in package-lock to 4.3.0
It seems the Angular WebPack build is not happy about the require('stream') in lzutf8.js and 'stream' package is not declared as dependency nor installed manually.
Should consider separating LZ-UTF8 package to 2 packages, for client and Node, Or somehow avoiding this issue without forcing Angular developers installing the 'stream' package event if not going to use it