-
Notifications
You must be signed in to change notification settings - Fork 9
/
rollup.config.mjs
39 lines (37 loc) · 1.1 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
import { definePlugins } from '@gera2ld/plaid-rollup';
import { readPackageUp } from 'read-package-up';
import { defineConfig } from 'rollup';
import userscript from 'rollup-plugin-userscript';
import serve from 'rollup-plugin-serve';
import image from '@rollup/plugin-image';
const { packageJson } = await readPackageUp();
export default defineConfig(
Object.entries({
'eureka': 'src/main/index.ts',
'eureka-meta': 'src/main/placeholder.ts',
}).map(([name, entry]) => ({
input: entry,
plugins: [
...definePlugins({
esm: true,
minimize: true,
postcss: {
inject: false,
minimize: true,
},
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
}),
image(),
userscript((meta) =>
meta.replace('process.env.AUTHOR', packageJson.author.name)
.replace('process.env.VERSION', packageJson.version)
),
process.env.ROLLUP_WATCH ? serve('dist') : undefined
],
output: {
format: name === 'eureka-meta' ? 'es' : 'iife',
file: `dist/${name}.user.js`,
indent: false,
},
})),
);