lustre-labs / dev-tools

Lustre's CLI and development tooling: zero-config dev server, bundling, and scaffolding.
45 stars 15 forks source link

Is it possible to have Erlang externals in a Lustre project? #64

Closed tankorsmash closed 1 month ago

tankorsmash commented 1 month ago

Hey!

I'm not sure if the terminology is correct but I'm trying to integrate lustre into my toy Gleam app, and it makes use of several Erlang-dependant things, like processes, its http client etc. I had thought my hello world Lustre wouldn't care because it doesn't import any of that stuff, but compiling my Gleam project with javascript as a target fails. This question might be better suited for Gleam itself, rather than Lustre, but just in case:

gleam run -m lustre/dev build seems to call something like gleam run -t javascript which fails. I can get around it by annotating certain functions with @external(javascript, "EMPTY", "EMPTY") but that is pretty sloppy, and my imports to erlang/process still fail.

Should I absolutely avoid using any Erlang things at all with my Lustre app?

hayleigh-dot-dev commented 1 month ago

Howdy! Gleam is not designed to have a single project handle separate erlang/javascript applications. It sounds like you might be doing some full-stack work and want to use Lustre for the frontend?

In these cases the best approach is a monorepo-style project where you have separate Gleam projects for both your frontend and your backend.

tankorsmash commented 1 month ago

Thank you, that makes sense!