-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: React Native support #287
Comments
The focus of this library is mainly on running on node and node-based environments (like Electron, Bun, etc.), but I don't rule out supporting React-native if it doesn't require significant changes and is not a great maintenance burden.
|
We probably have to wait for this PR facebook/hermes#1377 which is available in RN 0.75.0-rc.5 or newer. But even after that I don't know if android, ios is supported out of the box or not. However RN windows seems to have this implemented already microsoft/hermes-windows#61 . But I have not experimented with any one of them yet. I will continue to research on it and share my findings here. Here is two other discussions to follow for this topic 1) nodejs/abi-stable-node#459 and 2) facebook/hermes#1074 |
@raymon-io That looks promising! It would be great if you can, as part of your research, find some way to create a basic testsuite for the compatibility of a future support for React Native for Android/iOS/Windows/etc. |
Feature Description
Is it possible for
node-llama-cpp
to support React Native projects?I know that this project depends on many node standard libraries, but is it possible to make changes and run in RN runtime? Especially now that it supports arm64 Mac and Windows machines, is it possible to run in arm64 non-node environments?
Even just importing
node-llama-cpp
necessary functions produces error.On Android it gives error:
The package at "node_modules/node-llama-cpp/dist/evaluator/LlamaModel/LlamaModel.js" attempted to import the Node standard library module "process". It failed because the native React runtime does not include the Node standard library.
On React Native web (using expo) it gives the following error
The resource from “http://localhost:8081/node_modules/expo/AppEntry.bundle?platform=web&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.routerRoot=app” was blocked due to MIME type (“application/json”) mismatch
which comes from a <script> tag in html
<script src="/node_modules/expo/AppEntry.bundle?platform=web&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.routerRoot=app" defer></script>>
The Solution
Not asking to make huge changes but this is more like a theoretical question if experimental supporting of RN runtime is possible after removing or replacing node standard libraries.
Considered Alternatives
llama.rn https://github.com/mybigday/llama.rn
web-llm https://github.com/mlc-ai/web-llm
onnxruntime-react-native https://github.com/microsoft/onnxruntime/tree/main/js/react_native
The text was updated successfully, but these errors were encountered: