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.emit: (emit_stdlib true) can compile unnecessary modules #792

Open
anmonteiro opened this issue Oct 19, 2023 · 0 comments
Open

melange.emit: (emit_stdlib true) can compile unnecessary modules #792

anmonteiro opened this issue Oct 19, 2023 · 0 comments

Comments

@anmonteiro
Copy link
Member

There's currently a limitation in the melange rules + dune integration where the Melange runtime/stdlib is emitted to JS, in its entirety, for every melange.emit stanza.

This happens for a few reasons:

  • melange.emit is "total": one melange (target emit-folder) is self-contained and (hopefully) contains everything needed to run that application
    • this is by design and makes both rule implementation easier and adheres to the principle of least surprise
  • The Dune / ocamldep level of granularity for external dependencies are currently libraries, which means

An alternative workaround for this issue is #620:

  • to get around the emission time for melange.emit with (emit_stdlib true), we could:
    1. publish e.g. a @melange/melange NPM package
    2. use emit_stdlib false in more situations
    3. consume the melange runtime/stdlib from NPM
    • the tradeoff here is that it might become a bit harder to consume dev versions of melange between releases (the opam package / runtime npm package must be in sync)
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