Skip to content

Fix broken module script and dangling asset links - #445

Open
tomayac wants to merge 1 commit into
mainfrom
fix/broken-module-script-and-dangling-asset-links
Open

Fix broken module script and dangling asset links#445
tomayac wants to merge 1 commit into
mainfrom
fix/broken-module-script-and-dangling-asset-links

Conversation

@tomayac

@tomayac tomayac commented Aug 28, 2026

Copy link
Copy Markdown
Member

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 ran

script.js is an ES module (it starts with import {FilesetResolver, LlmInference} from …) but index.html loaded it as a classic script:

<script type="text/javascript" src="script.js"></script>

Every visit failed with Uncaught SyntaxError: Cannot use import statement outside a module, so none of the demo's code executed. Now type="module".

With that fixed the script runs and reaches Failed to initialize the task, which is the demo's documented placeholder state — MODEL_FILE_NAME is 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 favicon

All three carried <link rel="icon" type="image/svg+xml" href="/vite.svg" /> from the create-vite scaffold. None of the three ships vite.svg, or any icon asset at all, so the only effect was a 404 in the console. Removed.

wordup — 404 web app manifest

wordup shipped two identical manifests:

  • public/manifest.json, linked by hand from index.html
  • manifest.webmanifest, generated and injected by vite-plugin-pwa

chrome.dev does not serve .webmanifest files, so the injected link 404'd while the hand-written one resolved. Rather than leave the duplication, manifestFilename now makes vite-plugin-pwa emit manifest.json, and the redundant static copy and its hand-written <link> are gone — the plugin owns the manifest, generated from the manifest block already in vite.config.ts.

Verified against a build:

$ ls dist | grep -i manifest
manifest.json

$ grep -oE '<link[^>]*manifest[^>]*>' dist/index.html
<link rel="manifest" href="/web-ai-demos/wordup/manifest.json">

and the service worker precaches manifest.json.

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.
@tomayac
tomayac requested a review from andreban August 28, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant