Repository navigation
Conversation
The WebAssembly manifest hard-coded start_url to /index.html and scope to /, which repeats WasmShellWebAppBasePath and is wrong for an app hosted under a sub-folder. The bootstrapper now derives both from the base path when they are absent.
|
Tick the box to add this pull request to the merge queue (same as
|
This branch has not been deployed
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.
GitHub Issue (If applicable): closes #2268
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The WebAssembly manifest hard-codes
"start_url": "/index.html"and"scope": "/", repeatingWasmShellWebAppBasePathand breaking sub-folder hosting.What is the new behavior?
Both members are removed from the template manifest. The bootstrapper sets them from
WasmShellWebAppBasePathwhen absent (unoplatform/Uno.Wasm.Bootstrap#1086), so a new project getsstart_urlandscopeof/by default and follows the base path when it is changed. Until that bootstrapper change ships, a manifest without the two members falls back to the browser defaults, which resolve to the page that references the manifest.Why the base path rather than
/index.htmlThe template value
/index.htmlcaused a startup error in a real app: the installed PWA launched at a literal file path that the app's client-side router did not recognize as a route. Launching at the base path avoids that, and it is what the site serves for that URL anyway.Offline launch does not depend on the file name either. The service worker precaches every entry of
config.offline_files, whose first entry is the base path itself, so the cache holds a response under the/key (and one under/index.html). When the installed app opensstart_urloffline, the network-first fetch handler falls back tocaches.matchand finds it. No server redirect or SPA fallback is involved.The one thing to keep in mind is that the cached response for the base path must be a plain 200: a host that redirected
/to/index.htmlwould cache a redirected response, which browsers refuse to use for a navigation. IIS, Azure Static Web Apps and the shipped hosting configs serve/directly, so the base path is the right default.PR Checklist
Please check if your PR fulfills the following requirements:
Other information
Companion to unoplatform/Uno.Wasm.Bootstrap#1086.
Internal Issue (If applicable):