问题
Looking at the Blazor documentation I get the impression that it is meant to be used to develop client side browser applications.
A subset of this should be creating WASM output in the same way Rust does, but I cannot see any documentation that explains how can I create standalone WASM output which then can be called from JavaScript or if I can do it at all.
So is it possible to use Blazor or Belero (its F# cousin, based on Blazor) to create wasm libraries and not full applications?
回答1:
A subset of this should be creating WASM output in the same way Rust does
No.
Blazor runs on Mono. Mono itself is compiled to Wasm, but both Blazor and your software run as IL modules inside Mono. In the current implementation they are interpreted, not compiled to Wasm.
So is it possible to use Blazor [or ...] to create wasm libraries and not full applications?
No.
回答2:
You can create ASP.NET Core Razor components class libraries. Those libraries can contains code only such as services, and js interop scripts.
I wrote this library for exemple to use some AWS services in a Blazor app : Aguacongas.AwsServices
来源:https://stackoverflow.com/questions/59090045/can-blazor-create-wasm-modules-without-any-ui-references-or-code