rotemdan / lzutf8.js

A high-performance Javascript string compression library
MIT License
322 stars 26 forks source link

react-native missing dependencies #44

Open allandiego opened 2 years ago

allandiego commented 2 years ago

I was trying to use this lib in react native and got this error:

Unable to resolve module events from node_modules\readable-stream\lib_stream_readable.js: events could not be found within the project or in these directories: node_modules

to fix need install this 2 dependencies to work in react native readable-stream events

rotemdan commented 2 years ago

Hi, I believe these false error messages appear because the react compiler doesn't realize the imports are loaded dynamically - i.e. only when the Node environment is detected - it is analyzing code paths that are never actually executed (in a sense, the messages are false positives).

The issue only started during the last 2-3 years or so. The library was initially published in 2014 (8 years ago) and this form of static analysis wasn't included in common packers and frameworks, so it was functional both in Node and in the browser.

I don't have an intention to try to fix it (as it may require splitting the library to two different versions - something that I've strongly avoided from the very beginning). In general, I've mentioned in other threads the library has become outdated and requires a rewrite to update with new technologies - especially WebAssembly, as well as compatibility with various newer platforms (e.g. React native).

I don't have plans to work on this at any time in the foreseeable future.