fix(extension): emit no modulepreload links, which Chrome refuses to use - #248
Merged
Merged
Conversation
Every generated wallet page carried `<link rel="modulepreload" crossorigin>`
for each shared chunk its entry imports, and Chrome declined all of them:
A preload for 'chrome-extension://…/assets/bridge-protocol-….js' is
found, but is not used because it is a cross-world extension resource
mismatch.
The hint is fetched under a different resource world than the module graph
that `<script type="module">` then loads, so the preloaded copy never matches
the lookup and is discarded — each chunk fetched twice, and 18 warnings
across popup (4), options (6), confirm (4) and offscreen (4) on the
chrome://extensions Errors page.
Nothing was broken by them; the script tag is what actually loads the graph.
The cost is the page they filled. The Errors page is where a real fault has
to be noticed, and a screenful of benign warnings is how one gets scrolled
past — the same reasoning R7.2 applies to a lost prompt.
Preloading buys nothing here anyway: every asset is read from local disk,
with no network latency to hide. `manager.html` never had any, because
`codeSplitting: false` leaves the console no shared chunks to preload, and
`background.js` is a single bundle with no HTML at all — so this is the one
config that needed it.
Verified by building both ways: 18 links before, 0 after, with the entry's
own `<script type="module" crossorigin>` unchanged. Full three-config build,
726 extension tests and the dist guards (single background bundle, admin and
persona URIs confined to manager.js, no seeds family, one manager chunk) all
pass.
Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
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.
Every generated wallet page carried a
<link rel="modulepreload" crossorigin>for each shared chunk its entry imports, and Chrome declined all of them:The hint is fetched under a different resource world than the module graph that
<script type="module">then loads, so the preloaded copy never matches the lookup and is discarded — each chunk fetched twice, and 18 warnings across popup (4), options (6), confirm (4) and offscreen (4) on thechrome://extensionsErrors page.Nothing was broken by them; the script tag is what actually loads the graph. The cost is the page they filled. The Errors page is where a real fault has to be noticed, and a screenful of benign warnings is how one gets scrolled past — the same reasoning R7.2 applies to a lost prompt.
Preloading buys nothing here anyway: every asset is read from local disk, with no network latency to hide.
manager.htmlnever had any, becausecodeSplitting: falseleaves the console no shared chunks to preload, andbackground.jsis a single bundle with no HTML at all — sovite.config.tsis the one config that needed the option.Verification
Built both ways and counted the links:
The entry's own
<script type="module" crossorigin src="…">is unchanged, which is the tag that actually loads.npm run build --workspace @openvtc/pnm-extension(all three configs) — cleannpm test --workspace @openvtc/pnm-extension— 726 pass, 0 failbackground.jshas no dynamicimport();acl/*,contexts/delete,keys/signandpersona/attribute/putappear in no file butmanager.js; novta/seeds/*anywhere; nomanager-split-*.js; packaged manifest has nocontent_scripts; nochrome.cookiesindist/Pre-merge checklist (vti-stack-development-guide.md)
background.jsbundle,codeSplitting: falseon the console build