-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.mjs
42 lines (41 loc) · 1.09 KB
/
rollup.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { definePlugins } from '@gera2ld/plaid-rollup';
import { defineConfig } from 'rollup';
import userscript from 'rollup-plugin-userscript';
import pkg from './package.json' assert { type: 'json' };
export default defineConfig(
Object.entries({
translator: 'src/index.tsx',
}).map(([name, entry]) => ({
input: entry,
plugins: [
...definePlugins({
esm: true,
minimize: false,
postcss: {
inject: false,
minimize: true,
modules: {
generateScopedName: 'tr_[local]_[hash:base64:5]',
},
},
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
}),
userscript((meta) => meta.replace('process.env.VERSION', pkg.version)),
],
external: [
'@violentmonkey/ui',
'@violentmonkey/dom',
'@violentmonkey/shortcut',
],
output: {
format: 'iife',
file: `dist/${name}.user.js`,
globals: {
'@violentmonkey/dom': 'VM',
'@violentmonkey/ui': 'VM',
'@violentmonkey/shortcut': 'VM.shortcut',
},
indent: false,
},
})),
);