Stream: beginners

Topic: Trying to run roc-esbuild examples/ test, getting failure


view this post on Zulip Dillon Kearns (May 10 2024 at 16:38):

Has anyone tried this roc-esbuild repo? I get a failure when I run the test in the examples/ folder: https://github.com/vendrinc/roc-esbuild/blob/adc3b55592d962f5e38e9d0b653939c1a8eb2f53/examples/exclaim.test.js

+    Expected: "Hi, World!"
-    Received: "\"Hi, World\"!"

I tried passing in a number to exclaim and it works and gives back "123!" as the result (no extra quotes). Strange because it says it is Str -> Str: https://github.com/vendrinc/roc-esbuild/blob/adc3b55592d962f5e38e9d0b653939c1a8eb2f53/examples/src/main.roc#L6

I wonder if somewhere in the platform it's supposed to be a JSON value instead? https://github.com/vendrinc/roc-esbuild/blob/adc3b55592d962f5e38e9d0b653939c1a8eb2f53/examples/src/platform/main.roc#L2

Would appreciate any pointers if there is something in this example that is out of date!

view this post on Zulip Anton (May 10 2024 at 17:19):

@Richard Feldman

view this post on Zulip Richard Feldman (May 10 2024 at 17:25):

ah yeah it's probably out of date, I haven't worked on it in awhile :sweat_smile:

view this post on Zulip Richard Feldman (May 10 2024 at 17:25):

@Dillon Kearns what are you looking to do with it?

view this post on Zulip Dillon Kearns (May 10 2024 at 17:32):

Hey Richard! Yeah, I figured it probably got a bit out of date. I was hoping to put together a little demo of directly invoking Roc code from elm-pages using https://package.elm-lang.org/packages/dillonkearns/elm-pages/latest/BackendTask-Custom. That feature allows you to directly call NodeJS code from elm-pages as a BackendTask and send/receive JSON data from an async function.

Would be extra cool if I could use glue (create a glue spec, is that the right term for that?) to automatically create those bindings.

view this post on Zulip Dillon Kearns (May 10 2024 at 17:34):

Do you think it would be a better idea to try doing that using roc-esbuild, or something else? elm-pages does have a Vite integration, so I could define a Vite plugin there, not sure if that would be a good direction for it.

view this post on Zulip Richard Feldman (May 10 2024 at 17:47):

ah gotcha! Yeah if it's just sending JSON, I can take a look at updating the roc-esbuild example

view this post on Zulip Richard Feldman (May 10 2024 at 17:47):

I might have time after work tonight or maybe tomorrow!

view this post on Zulip Dillon Kearns (May 10 2024 at 18:15):

Sounds good! No rush, but if anything obvious sticks out then that would definitely be helpful!


Last updated: Jul 06 2025 at 12:14 UTC