Open jessitron opened 2 years ago
Thanks for reporting this! To set expectations:
Finally, please be patient with the core team. They are trying their best with limited resources.
update: I can't find the docs repo, so I won't make a PR there. :-(
Yeah, it's unfortunately not easy to discover https://github.com/evancz/guide.elm-lang.org
Quick Summary: ???
An example HTML file on this page: https://guide.elm-lang.org/webapps/ shows calling in to Elm like this:
<script>var app = Elm.Main.init();</script>
which produces a page that does not load, and fails with this error in the console:
The real failure is that my Elm code is returning a
Browser.element
instead of aBrowser.document
.In this case, PLEASE TELL PEOPLE THAT.
SSCCE
Additional Details
While the "webapp" instruction page does talk about "First convert your main to return a document," It doesn't provide an example of how to do that. I struggled to find one. It is not a conversion that a beginner (or someone who hasn't touched Elm in years) can do.
I eventually found an example of an html file that works with a Browser.element on the "JavaScript Interop" page. When I wanted to build a trivial webapp, that's not where I went. I'll try to make a PR of some sort to the docs.
I really want the compiler to give a useful error message when 'node' is not provided to Elm.Main.init(). Something like "You need to tell Elm what element to load your app into. like..."