Skip to content

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

@davesnx

Description

@davesnx
[@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions