docs: Vite plugin demo app and README for 4.6.0
Summary
README and demo for the Vite plugin released in 4.6.0 (#84). The hosted docs change in missing-elements.github.io#108.
demo/vite-plugin/is a minimal Vite app with the plugin. It installs the published package (^4.6.0), so it doesn't depend on a local build. Its PDF holds one scanned image compressed with CCITT, which PDF.js decodes withwasm/jbig2.wasm. Its README says how to run it and how to see the problem the plugin solves.- README: Vite and the frameworks built on it get the plugin, and webpack, Next.js and other bundlers get the copy +
assets-base. Both link to the new docs sections, and the cache note points to the docs before an upgrade. demo/assets-base.html: its comment said bundlers don't needassets-base. Bundled apps do need it for the data, unless they use the plugin..gitignore:publicā/public, so only the root folder the sync script fills is ignored and the demo can keep its PDF in its ownpublic/. The lockfile the demo creates is ignored.
Note for the README links
#vite-plugin and #other-bundlers-and-assets-base exist only after the docs PR merges. Merge that one first, or together with this one.
Validation
The demo was installed from npm into a scratch folder (4.6.0, Vite 8.3.8), built, served with vite preview and opened in Firefox:
| Build | Left half of the page | Console |
|---|---|---|
| With the plugin (297 files) | black | no warnings |
| Without the plugin (11 files) | white | Unable to decode image "img_p0_1": "Jbig2Error: JBig2 failed to initialize" |
vite dev, without the plugin | black | no warnings |
vite preview answers the missing assets/wasm/ files with the app's HTML page and a 200, not a 404, so the demo's README describes the console warning rather than a 404.
Checklist
- The change is focused and includes tests for behavior changes. No behavior changes: docs, a demo and an ignore rule.
- Relevant tests and the build pass locally.
- Public API, behavior, or user-guidance documentation is updated where needed.
- Accessibility impact has been considered, including keyboard navigation and focus visibility. The viewer is untouched.
- This pull request does not disclose a security vulnerability.
š¤ Generated with Claude Code
Summary by cubic
Adds a minimal Vite demo app and updates the README to document the Vite plugin shipped in 4.6.0. The demo installs the published package and reproduces the blank-page problem that occurs when an app is built without the plugin.
demo/vite-plugin/is a minimal Vite app with a CCITT-compressed scan; built without the plugin the image stays white with aJbig2Errorconsole warning.- The README now points Vite-based frameworks to the plugin, and webpack, Next.js and other bundlers to copying
distplusassets-base, linking to the new docs sections. It also says what to do when the host caches assets asimmutable. .gitignorenow ignores only the rootpublic/folder so the demo can keep its PDF, and ignores the demo's generated lockfile.- The
assets-base.htmlcomment now notes that bundled apps need it for the PDF.js data unless they use the plugin.