Reputation: 3292
I am learning how to use WebSharper. Actually, I am failing to learn how to use WebSharper.
I wanted to learn how to build a simple SPA so I followed this tutorial from the WebSharper page. I am able to create the SPA with Visual Studio and Zafir
(the codename for WebSharper 4.0 that is in beta). I followed every step in the tutorial. I have created a repo on github that is everything in the SPA.
The project won't build. More specifically, in the Client.fs
file, I get compiler error
The value or constructor P is not found
in line 10 with the P
, in line 11 the same error with the Div
, and in line 18 I get the error
Namesapces cannot contain values. Consider using a module to hold your value declrations.
with Run()
, yet when I try to move the [<SPAEntryPoint>]
information into the module HelloWorld
, I get the error
Lookup on object of indeterminate type based on information prior to this program point. A type annotation...
As a result, when I try to build this project, the build fails.
Why am I getting these errors? Is the tutorial out of date with the rest of WebSharper? What can I do to get a simple tutorial to work correctly?
EDIT: I get the same errors when I use WebSharper v3.x, too.
Upvotes: 3
Views: 168
Reputation: 391
Thanks for the report! I have updated documentation, indeed that page was not updated since a while. I will review it more thoroughly.
The source of the documentations are found at https://github.com/intellifactory/websharper.docs, feel free to add issue there about further questions/problems or also you can submit a PR.
Upvotes: 1
Reputation: 3292
Although not mentioned in the tutorial, adding
open WebSharper.Html.Server
eliminated the compiler errors with P
and Div
, adding
open WebSharper.Html.Client
eliminated a new compiler error of OnClick
, and moving the [<SPAEntryPoint>]
into the module eliminated that compiler error and allowed me to build the project.
Upvotes: 3