elringus / bootsharp

Compile C# solution into single-file ES module with auto-generated JavaScript bindings and type definitions

Home Page:https://bootsharp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add an option to side-load binary boot data

elringus opened this issue · comments

While packing everything to a single .js library is convenient and even required in some cases (eg, for VS Code web extensions), it adds about 30% of extra size due to binary->base64 conversion of the WASM and DLLs.

We should add a build option to not pack the binary boot data with the emitted .js and instead allow the data to be side-loaded by the consumer; this way the binary files can be streamed directly from the server to optimize the traffic/initial load time.

Skipping boot function override should be enough to achieve that (bootData would be provided by the consumer): https://github.com/Elringus/DotNetJS/blob/a126393aed63581ec3078db0a382dffc84adfad2/DotNet/Packer/LibraryGenerator.cs#L17-L25