Skip to content
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

melange externals should be marked as browser_only, instead of raising #170

Open
davesnx opened this issue Oct 8, 2024 · 0 comments
Open

Comments

@davesnx
Copy link
Member

davesnx commented Oct 8, 2024

[@mel.scope "window"] [@mel.return nullable]
external enablePatches: option(bool) = "ENABLE_PATCHES";

should generate a raising fn in native:

let enablePatches = _ => raise(Impossible_in_server(...))

This might be a bit trickier since we need to count arities, including mel.send and mel.send.pipe, but regardless core from melange.ppx should help here.


Error message should be more descriptive

[server-reason-react.melange_ppx] There's an external in native, which should
only happen in JavaScript. You need to conditionally run it, either by not
including it on native or via let%browser_only/switch%platform. More info at
https://ml-in-barcelona.github.io/server-reason-react/local/server-reason-react/browser_only.html
[server-reason-react.melange_ppx] There's an external in native, which should
only happen in JavaScript. You need to conditionally avoid it, either by not
including it on native and run inside a let%browser_only/switch%platform function. More info at
https://ml-in-barcelona.github.io/server-reason-react/local/server-reason-react/browser_only.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant