-
Notifications
You must be signed in to change notification settings - Fork 17
/
rollup.config.js
executable file
·79 lines (76 loc) · 1.33 KB
/
rollup.config.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import terser from '@rollup/plugin-terser';
import alias from '@rollup/plugin-alias';
import {defineConfig} from 'rollup';
import {fileURLToPath} from 'node:url';
const TERSER = terser({
compress: {
toplevel: true,
passes: 2,
dead_code: true
}
});
const NATIVE_NF = alias({entries: {
'./nf.js': fileURLToPath(new URL('./src/nf-native.js', import.meta.url))
}});
export default defineConfig([
{
input: './src/lib.js',
output: [
{
file: './dist/index.mjs',
format: 'es',
},
{
file: './dist/index.min.js',
format: 'es',
plugins: [TERSER],
},
{
file: './dist/index.cjs',
format: 'cjs',
},
],
},
{
input: './src/lib.js',
plugins: [NATIVE_NF],
output: [
{
file: './dist/index-xnf.mjs',
format: 'es',
},
{
file: './dist/index-xnf.min.js',
format: 'es',
plugins: [TERSER],
},
{
file: './dist/index-xnf.cjs',
format: 'cjs',
},
],
},
// these are for /test/
{
input: './src/nf.js',
output: {
file: './dist/nf.min.js',
format: 'es',
plugins: [TERSER],
},
},
{
input: './src/all.js',
output: [
{
file: './dist/all.js',
format: 'es',
},
{
file: './dist/all.min.js',
format: 'es',
plugins: [TERSER],
}
],
},
]);