-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.mjs
36 lines (35 loc) · 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
import { definePlugins } from '@gera2ld/plaid-rollup';
import { defineConfig } from 'rollup';
import userscript from 'rollup-plugin-userscript';
import serve from 'rollup-plugin-serve';
import image from '@rollup/plugin-image';
import pkg from './package.json' assert { type: 'json' };
export default defineConfig(Object.entries({
'charlotte': 'src/core/index.ts',
}).map(([name, entry]) => ({
input: entry,
plugins: [
...definePlugins({
esm: true,
minimize: process.env.NODE_ENV === 'production',
postcss: {
inject: false,
minimize: true,
},
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
}),
image(),
userscript((meta) =>
meta.replace('process.env.AUTHOR', pkg.author)
.replace('process.env.VERSION', pkg.version)
),
process.env.ROLLUP_WATCH ? serve('dist') : undefined
],
output: {
format: 'iife',
file: `dist/${name}.user.js`,
banner: `(async () => {`,
footer: `})();`,
indent: false,
},
})));