docs: Vite plugin demo app and README for 4.6.0

Merged
AL
15h ago
+86-10

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 with wasm/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 need assets-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 own public/. 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:

BuildLeft half of the pageConsole
With the plugin (297 files)blackno warnings
Without the plugin (11 files)whiteUnable to decode image "img_p0_1": "Jbig2Error: JBig2 failed to initialize"
vite dev, without the pluginblackno 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 a Jbig2Error console warning.
  • The README now points Vite-based frameworks to the plugin, and webpack, Next.js and other bundlers to copying dist plus assets-base, linking to the new docs sections. It also says what to do when the host caches assets as immutable.
  • .gitignore now ignores only the root public/ folder so the demo can keep its PDF, and ignores the demo's generated lockfile.
  • The assets-base.html comment now notes that bundled apps need it for the PDF.js data unless they use the plugin.