A Vite plugin for developing and building userscripts (.user.js) targeting Tampermonkey, Violentmonkey, Greasemonkey, and ScriptCat. Current stable version is 7.1.9, with frequent releases addressing edge cases and HMR improvements. Key differentiator: leverages Vite's fast dev server with hot reload for userscripts, supports TypeScript, CSS modules, and advanced GM_ API types. Requires Vite ^6.0.0 || ^7.0.0 as peer dependency.
npm install vite-plugin-monkeyVerified import paths — ran on the pinned version, not inferred.
Basic Vite config for a userscript that shows on example.com and uses GM_notification.
Upgrade Vite to 6.x or 7.x, or stay on vite-plugin-monkey v6 if using Vite 5.
Use 'styleImport' feature (v7.1.0+) for better CSS injection support, or trigger a full reload after style changes.
Upgrade to v7.1.5 or later which fixes this issue.
Use the global 'expose' provided by the plugin's inject script rather than importing it directly.
Run 'npm install vite-plugin-monkey --save-dev' (or yarn/pnpm equivalent).
Change to 'import vitePluginMonkey from 'vite-plugin-monkey''.
Upgrade vite-plugin-monkey to v7.1.5 or later, or modify the userscript to run at document-end.