Repository navigation
fix: Only relocate index.html references to package files - #1084
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Generated uno-config.js is omitted from the package reference set, leaving references to it unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Fixes index.html reference relocation so only package-deployed files are rewritten, preserving root and external references.
Changes:
- Adds selective relocation with query and fragment preservation.
- Updates PWA icon path handling.
- Adds tests, specification, and documentation.
| File | Summary |
|---|---|
src/Uno.Wasm.Bootstrap/ShellTask.cs |
Builds package references and updates PWA icon handling. |
src/Uno.Wasm.Bootstrap/IndexHtmlHelper.cs |
Implements selective reference relocation. |
src/Uno.Wasm.Bootstrap.UnitTests/Given_IndexHtmlHelper.cs |
Tests relocation and untouched references. |
specs/006-index-html-reference-relocation/spec.md |
Documents requirements and validation. |
doc/features-additional-files.md |
Documents custom index behavior. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
The The signing step is meant to be skipped on pull requests, but its |
The index.html rewrite prefixed every double-quoted reference starting with ./ or with the web app base path with the package folder. With the / base path that Uno.Sdk applies by default, this rewrote every site-absolute reference in a custom page: /favicon.ico, /api/status and even href="/" ended up under package_<hash>/. Only references whose path is a file deployed to the package folder are relocated now; query strings and fragments are preserved. The apple-touch-icon link is emitted with the icon's package path directly instead of depending on the rewrite.
46884d2 to
5b0fb60
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Relative base paths such as ./app/ need corrected matching order and a regression test.
0 open findings
🧠 Review effort: Lite
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
🤖 Addressed PR comments up to this point
|
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |

Fixes #1083
What is the current behavior?
The
index.htmlrewrite prefixes every double-quoted reference starting with./or with the web app base path with the package folder. With the/base path Uno.Sdk applies by default, every site-absolute reference in a custom page is rewritten:/favicon.ico,/api/statusandhref="/"all end up underpackage_<hash>/.What is the new behavior?
GenerateIndexHtml()builds the set of package-relative paths from the static web content deployed topackage_<hash>/and only relocates references whose path is in that set, via a newIndexHtmlHelper.RelocatePackageReferences. Query strings and fragments are preserved. Everything else is left as written.The
apple-touch-iconlink generated from the PWA manifest previously depended on the blind rewrite (it was emitted as<base>./pwa-images/...and then rewritten). It is now emitted with the icon's package path directly, using the same relocation as the manifest'siconsentries.Spec:
specs/006-index-html-reference-relocation/spec.md. Doc:features-additional-files.md.Validation
Given_IndexHtmlHelperunit tests: relocation under./,/and/app/, query string and fragment preservation, and the untouched cases above. Unit test project passes, 56 tests.Uno.Wasm.Tests.Fingerprintbuilt with/app/and a PWA manifest produces a byte-identicalindex.htmlbefore and after the change.index.htmlwith/favicon.ico,fetch("/api/status"), an external script andhref="/": only./require.js,./uno-bootstrap.jsand the injected stylesheets point into the package folder; the rest is unchanged.Uno.Wasm.Sample.RayTracer(PWA with icons under./pwa-images/): theapple-touch-iconlink resolves to./package_<hash>/pwa-images/ios/ios-appicon-1024-1024.png, and the manifest icon entries are unchanged.