Fix the Vite plugin notes from the #108 review

Merged
AL
11h ago
+3-3

Summary

Fixes the four review comments on #108, which merged before they were addressed. All four were correct:

  • Resource attributes (the comment on line 250): the page said assets-base or a resource attribute makes the plugin's copy unused. Only assets-base does that. A resource attribute such as c-map-url replaces only its own folder, and the element still loads the rest from the plugin's copy. This matches getResourceOption in the element.
  • Frameworks bullet (the two comments on line 362): it named only SvelteKit, Nuxt and Astro, so a React or Vue app on plain Vite, or a React Router app, could read past it. It now says any Vite app, with those four as examples.
  • Migrating from 4.5.0 (the comment on line 538): it said the plugin can replace the copy of dist, but not that assets-base has to go. While assets-base is set, the element ignores the plugin's copy. The step now says to add the plugin and then remove assets-base, any resource attributes that point at the copy, and the copy step.

Validation

pnpm build passes, and every href="#…" on _site/pdfjs-viewer/index.html matches an id, including the new link to #pdf-js-resources.

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes the four review notes on #108, which merged before they were addressed. The docs now match how the element and plugin actually behave.

  • A resource attribute such as c-map-url replaces only its own folder; only assets-base makes the plugin's copy unused. Without assets-base, the folders an attribute doesn't replace come from the plugin's copy.
  • The plugin note now says the Vite plugin works in any Vite app, with SvelteKit, Nuxt, Astro and React Router as examples.
  • The 4.5.0 migration step now says to add the plugin, then remove assets-base, any resource attributes pointing at the copy, and the copy step, since the element ignores the plugin's copy while assets-base is set.