-
Notifications
You must be signed in to change notification settings - Fork 189
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
[BUG] Produced code invariably requires node:fs (dead code) #1809
Comments
Try |
@hhugo this indeed removes the dependency on However, this brings in references to However, this also creates issues with references to JS object implemented in Ocaml and accessed from another library's |
You need to set the flag when building the runtime |
Printing to stdout with |
Is there a way to somehow force non-inclusion of a module (e.g. Or is there a way to trace down which libraries/modules/functions pull in dependencies like the one we are talking about? |
no
manual inspection
I don't know where this reference come from. I don't think it's related to I don't know the constraints impose by react native. Maybe you can update jsoo to support |
This, in combination with |
Describe the bug
Let's say we have the simplest possible OCaml program:
Which we compile using jsoo:
Although the program performs no file operations, the generated code still requires
node:fs
and contains filesystem functions, even on the highest optimization level, even when asked to eliminate all dead code, even with--profile release
.This is extremely problematic for deployments to React Native platforms, where the module does not exist.
Expected behavior
Filesystem functions should not be included unless actually used.
As an alternative, the module could be loaded lazily.
Versions
ocamlc: 5.2.1
js_of_ocaml: 5.9.1
The text was updated successfully, but these errors were encountered: