Vite plugin (v1.0.1) for zero-config deployment to GitHub Pages. Leverages the gh-pages package to publish built output to a branch (default: gh-pages) with automatic base URL inference from package.json#name. Includes lifecycle hooks (onBeforePublish, onPublish, onError) and sensible defaults (preserves dotfiles, adds .nojekyll). Active maintenance, ships TypeScript types, and supports all gh-pages options. Differentiator: first-class Vite integration vs manual gh-pages scripts.
npm install vite-plugin-gh-pagesVerified import paths — ran on the pinned version, not inferred.
Configure Vite with ghPages plugin, setting base path and custom deploy message with lifecycle hook.
Review gh-pages v6 release notes; update plugin options if using removed features like `only` (deprecated).
Set base explicitly in vite.config: base: '/your-repo-name/'
Ensure no other `enforce: 'post'` plugins conflict; order within plugins array matters.
If you want both default and custom messages, call the default logic inside your callback or omit onPublish.
Use `remove` instead of `only` when specifying patterns to remove.
npm install --save-dev vite-plugin-gh-pages. Ensure tsconfig includes node_modules/@types or skipLibCheck.
Add a remote: 'git remote add origin git@github.com:user/repo.git' or set `remote` option to an existing remote name.
Change to `import { ghPages } from 'vite-plugin-gh-pages'`.