vite-plugin-userscript
v0.1.3
Published
## Get Started
Downloads
123
Maintainers
Readme
vite-plugin-userscript
Get Started
pnpm i -D vite-plugin-userscript
// vite.config.js
import { defineConfig } from 'vite';
import { metablock } from 'vite-plugin-userscript';
export default defineConfig({
plugins: [
metablock(),
],
build: {
lib: {
entry: 'index.js',
name: 'my-awesome-userscript',
},
rollupOptions: {
output: {
extend: true,
format: 'umd',
entryFileNames: 'my-awesome-userscript.user.js',
},
},
},
});
Full options
metablock({
// support json / json5 / yaml.
file: './metablock.json',
// show hints if you only want to write for specific script manager.
manager: 'all',
// dynamic override the meta from meta file
override: {
name: require('package.json').name
},
order: ['name', 'description', 'namespace', '...', 'grant'],
// the action when meet invalid meta
errorLevel: 'warn'
// append metablock to which output files
applyTo: /[.]user[.]js$/
})
Examples
See examples folder