Support Blazor WebAssembly hosts in the static build - #64
Merged
Merged
Conversation
…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.
|
🛰️ Docs preview: https://pr-64.pennington-dev.pages.dev Rebuilt on every push to this PR; torn down when it closes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsfetches aresource-collectionES 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 noStaticAssetDescriptorand no backing file, so the copy phase misses it and a purely static host (e.g. GitHub Pages) 404s on WASM boot..js.gzvariants are skipped (a dumb static host serves the identity.jsthe boot script requests).Accept base-relative
_framework/paths in link verification (LinkVerificationService)srcresolved 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.