Fix broken module script and dangling asset links - #445
Open
tomayac wants to merge 1 commit into
Open
Conversation
Three console errors visible on the deployed demos at https://chrome.dev/web-ai-demos/: right-click-for-superpowers loaded an ES module as a classic script, so it failed with "Cannot use import statement outside a module" and never ran at all. Marking it type="module" lets it execute; it then reaches the documented placeholder state where MODEL_FILE_NAME still needs a hosted Gemma model, as the readme describes. firebase-ai-logic, summarization-api-playground and summary-of-summaries each linked /vite.svg as their favicon. None of the three ships that file, or any icon asset, so the link is leftover create-vite scaffolding that only produced a 404. Dropped it. wordup shipped two identical manifests: a static public/manifest.json linked from index.html, and vite-plugin-pwa's generated manifest.webmanifest, injected alongside it. chrome.dev does not serve .webmanifest, so the injected one 404'd. Set manifestFilename so vite-plugin-pwa emits manifest.json, and dropped the now-redundant static copy and its hand-written link tag. The build now emits a single manifest.json, referenced by a single link tag and precached by the service worker.
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.
Three console errors that are visible on the deployed demos at https://chrome.dev/web-ai-demos/. Found while checking every demo's console after a deploy; each is independent, so they can be split if preferred.
right-click-for-superpowers— demo never ranscript.jsis an ES module (it starts withimport {FilesetResolver, LlmInference} from …) butindex.htmlloaded it as a classic script:Every visit failed with
Uncaught SyntaxError: Cannot use import statement outside a module, so none of the demo's code executed. Nowtype="module".With that fixed the script runs and reaches
Failed to initialize the task, which is the demo's documented placeholder state —MODEL_FILE_NAMEis still'https://', and the readme asks you to host your own Gemma model from Kaggle and point the code at it. That part is unchanged and intentional.firebase-ai-logic,summarization-api-playground,summary-of-summaries— 404 faviconAll three carried
<link rel="icon" type="image/svg+xml" href="/vite.svg" />from thecreate-vitescaffold. None of the three shipsvite.svg, or any icon asset at all, so the only effect was a 404 in the console. Removed.wordup— 404 web app manifestwordupshipped two identical manifests:public/manifest.json, linked by hand fromindex.htmlmanifest.webmanifest, generated and injected byvite-plugin-pwachrome.dev does not serve
.webmanifestfiles, so the injected link 404'd while the hand-written one resolved. Rather than leave the duplication,manifestFilenamenow makesvite-plugin-pwaemitmanifest.json, and the redundant static copy and its hand-written<link>are gone — the plugin owns the manifest, generated from themanifestblock already invite.config.ts.Verified against a build:
and the service worker precaches
manifest.json.