Closed dysinger closed 1 year ago
I will make a reference to #24 here but that issue is over a year old and, I think, somewhat unrelated to current problems.
Hello!
Does changing them to intead use bonsai.web
(intead of bonsai_web
) and bonsai.ppx_bonsai
(intead of ppx_bonsai
) make things build?
My current understanding of how dune
works is that libraries have two kinds of names; a "name" and a "public_name". Libraries within the same project can refer to things by their "name", but libraries outside of the project must refer to things via their "public_name". The public name for both of these is defined within [1] and [2]
I am not fully confident this fixes the build for your case (I'd still need to reproduce this locally), but please let us know/follow up if it does/doesn't.
[1] https://github.com/janestreet/bonsai/blob/master/ppx_bonsai/src/dune [2] https://github.com/janestreet/bonsai/blob/master/web/dune
Thanks for the tip. I made those changes and some others and got the hello world example to work in my project.
Notice I had to add virtual_dom
to the libraries in the dune
file as well. Additionally, I had to add an open
statement in main.ml for the library. After doing so it complied without error.
As I think that your question has been answered, I will be closing this issue. Please feel free to re-open it if you have anything follow up question/want to re-open discussion. Thanks!
I think it would be good to have clear examples that compile and work. That problem isn't solved and there isn't a ticket for it. @Enoumy
The examples build if you're building them out of this repository. They do not work if you copy them into your own project. This is because they have different names that you can use to reference them in dune, and you just kinda need to know this. I agree it's not great, but it's not clear what changes should be made on our end.
Here's the simplest example:
./examples/hello_world
to your own project.You'll end up with errors like the following: