-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.ts
48 lines (46 loc) · 1.12 KB
/
rollup.config.ts
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
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import { unlinkSync } from 'fs';
import { join, resolve } from 'path';
import { RollupOptions } from 'rollup';
import postcss from 'rollup-plugin-postcss';
import { swc } from 'rollup-plugin-swc3';
import { htmlInsert } from './src/rollup-plugin/rollup-plugin-html-insert.js';
const rollupOption: RollupOptions = {
input: 'src/index.ts',
plugins: [
swc(),
htmlInsert(),
nodeResolve(),
commonjs(),
postcss({
include: '**/skin.css',
inject: true,
extract: false,
}),
postcss({
include: '**/content.css',
inject: true,
extract: false,
}),
terser({
output: { comments: false },
}),
{
name: 'clean_up',
closeBundle: () => {
try {
unlinkSync(join(resolve(), 'dist', 'index.js'));
} catch (_) {}
},
},
],
output: {
dir: 'dist',
format: 'umd',
inlineDynamicImports: true,
experimentalMinChunkSize: 10000,
},
};
export default rollupOption;