Develop and build userscripts for Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat, and other userscript engines with Vite.
Documentation: https://vite-plugin-monkey.pages.dev/
- Support Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat, and other userscript engines
- Inject userscript metadata into the build output
- Open the development userscript in the default browser when its metadata changes
- Load external dependencies through userscript
@requireentries - Load external modules through userscript
@resourceentries - Import GM APIs through ESM with type hints
- Collect the GM APIs used by the code and configure
@grantautomatically - Support top-level await and dynamic imports in a single userscript file
- Open the built userscript automatically when running Vite preview
- Support TypeScript and Vite features
Create a userscript project with the scaffolding tool:
pnpm create monkey
# npm create monkey
# yarn create monkeyChoose one of the included templates:
| JavaScript | TypeScript |
|---|---|
| empty (only js) | empty-ts (only ts) |
| vanilla (js + css) | vanilla-ts (ts + css) |
| vue | vue-ts |
| react | react-ts |
| preact | preact-ts |
| svelte | svelte-ts |
| solid | solid-ts |
Install the plugin in an existing Vite project:
pnpm add -D vite-plugin-monkey
# npm i -D vite-plugin-monkey
# yarn add -D vite-plugin-monkeyAdd vite-plugin-monkey as the last item in the Vite plugin list. See the Getting Started guide for the basic configuration.


