Skip to content

Support Blazor WebAssembly hosts in the static build - #64

Merged
phil-scott-78 merged 2 commits into
mainfrom
feat/wasm-boot-manifest
Jul 7, 2026
Merged

phil-scott-78 merged 2 commits into
mainfrom
feat/wasm-boot-manifest

Conversation

@phil-scott-78

Copy link
Copy Markdown
Contributor

Why

A Blazor Web App with an interactive-WebAssembly island doesn't survive a Pennington static build today: the WASM boot manifest 404s on a static host, and the link verifier flags the boot script as broken on every page. This makes both work.

What

Materialise the WASM boot manifest (WebAssemblyBootAssetDiscovery + OutputGenerationService)

  • blazor.web.js fetches a resource-collection ES module (_framework/resource-collection*.js) listing every WASM resource to load. Unlike the assemblies/runtime — physical files the static-asset copy phase already emits — this manifest is synthesised at request time by an endpoint the WebAssembly render mode registers. It has no StaticAssetDescriptor and no backing file, so the copy phase misses it and a purely static host (e.g. GitHub Pages) 404s on WASM boot.
  • The running host serves it during the crawl, so we discover it from the endpoint data source and treat it like any other GET route, letting the fetch phase write it to disk. Both the fingerprinted route and its unfingerprinted alias are emitted; precompressed .js.gz variants are skipped (a dumb static host serves the identity .js the boot script requests).

Accept base-relative _framework/ paths in link verification (LinkVerificationService)

  • The standard boot script emits a base-relative src resolved by <base href>: <script src="_framework/blazor.web.js">. Verification only skipped the root-absolute form, so a Blazor WebAssembly host flagged its own boot script as a broken link on every page. Normalise to root-absolute before the framework-asset check.

Tests

  • WebAssemblyBootAssetDiscoveryTests — discovers the manifest module, includes the unfingerprinted alias, dedupes content-negotiation duplicates, and skips precompressed/parameterised/unrelated routes.
  • LinkVerificationServiceTests.RelativeFrameworkAsset_IsRecognizedAsValid — the base-relative boot script is recognised as valid.

All 38 tests across both affected classes pass; core builds clean with zero warnings.

…tic build

The WASM boot manifest (_framework/resource-collection*.js) is a runtime
endpoint synthesised by the WebAssembly render mode, not a physical static
asset, so the static-asset copy phase misses it and a purely static host
(e.g. GitHub Pages) 404s on WASM boot. Discover it from the endpoint data
source and crawl it like any other GET so the fetch phase writes it to disk.
…rification

The standard Blazor boot script emits a base-relative src (resolved by
<base href>): `<script src="_framework/blazor.web.js">`. Link verification
only skipped root-absolute framework paths, so a Blazor WebAssembly host
flagged its own boot script as a broken link on every page. Normalise to
root-absolute before the framework-asset check.
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🛰️ Docs preview: https://pr-64.pennington-dev.pages.dev

Rebuilt on every push to this PR; torn down when it closes.

@phil-scott-78
phil-scott-78 merged commit 4837bed into main Jul 7, 2026
4 checks passed
@phil-scott-78
phil-scott-78 deleted the feat/wasm-boot-manifest branch July 7, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant