This is a Proof of Concept (POC) for running F# scripts in the browser using WebAssembly (WASM) via Bolero and FSharp.Compiler.Service.
- .NET 9.0 SDK
- Local build of
BoleroandBolero.FCS.Build(configured innuget.configandWasmScriptPoc.fsproj)
-
Navigate to the project directory:
cd WasmScriptPoc
-
Run the application:
dotnet run
-
Open your browser to the URL shown (usually
http://localhost:5xxx).
- The application loads.
- It downloads necessary reference assemblies (DLLs) from the
/refsendpoint (served fromwwwroot/refs). - It initializes the
FSharpChecker. - When you click "Compile & Run", it sends the code to the in-browser compiler.
- The compiler parses and checks the code against the downloaded references.
- If successful, it reports success (and would technically produce an assembly in memory/virtual FS).
Main.fs: Contains the UI (Elmish), Compiler logic, and EntryPoint.WasmScriptPoc.fsproj: Project configuration, references local Bolero source and Bolero.FCS.Build package.wwwroot/refs: Directory populated with DLLs during build, used by the compiler for references.
Bolero.FCS is here: https://github.com/ingted/Bolero.FCS.Build
This Bolero FCS is based on commit: 6396a18a707b29f552373b8ff5650c98beb9bcfc of https://github.com/dotnet/fsharp Parallel compilation is removed...