-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.mjs
52 lines (50 loc) · 1.55 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
43
44
45
46
47
48
49
50
51
52
import {defineExternal, definePlugins} from '@gera2ld/plaid-rollup';
import eslint from '@rollup/plugin-eslint';
import typescript from '@rollup/plugin-typescript';
import path from 'path';
import {defineConfig} from 'rollup';
import userscript from 'rollup-plugin-userscript';
import pkg from './package.json' with {type: 'json'};
const baseImportUrl = 'src';
export default defineConfig(
Object.entries({
'setlistfm-musicbrainz-import': 'src/setlistfm-musicbrainz-import/index.ts',
'acum-work-import': 'src/acum-work-import/index.ts',
}).map(([name, entry]) => ({
logLevel: 'debug',
input: entry,
watch: {
include: 'src/**/*.{ts,tsx}',
},
plugins: [
eslint({
throwOnError: true,
}),
typescript(),
...definePlugins({
esm: true,
minimize: false,
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
postcss: {
inject: false,
minimize: true,
},
aliases: {
entries: [{find: 'src', replacement: path.resolve(baseImportUrl)}],
},
}),
userscript(meta => meta.replace('process.env.AUTHOR', `${pkg.author.name} (${pkg.author.email})`)),
],
external: defineExternal(['@violentmonkey/ui', '@violentmonkey/dom', 'solid-js', 'solid-js/web']),
output: {
format: 'iife',
file: `src/${name}/dist/${name}.user.js`,
globals: {
'solid-js': 'VM.solid',
'solid-js/web': 'VM.solid.web',
'solid-js/store': 'VM.solid.store',
'@violentmonkey/ui': 'VM',
},
},
}))
);