-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
78 lines (75 loc) · 2.1 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
import {terser} from 'rollup-plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
import path from 'path';
function build(){
const name = 'containing-triangle';
return [
{
input: `${name}.ts`,
output: {
name,
format: 'es',
file: `lib/${name}.mjs`
},
external: ['robust-predicates'],
plugins: [typescript()]
},
{
input: `reroll.mjs`, // typescript & resolve don't play well together
output: {
name,
format: 'commonjs',
file: `lib/${name}.cjs`,
exports: 'default'
},
plugins: [typescript(), resolve()]
},
{
input: `reroll.mjs`,
output: {
name,
format: 'umd',
file: `lib/${name}.js`,
exports: 'default'
},
plugins: [resolve()]
},
{
input: `reroll.mjs`,
output: {
name,
format: 'umd',
file: `lib/${name}.min.js`,
exports: 'default'
},
plugins: [resolve(), terser()]
}
];
}
function test(name){
return [
{
input: `${name}.ts`,
output: {
name,
format: 'es',
file: `test/${name}.mjs`
},
external: ['robust-predicates', 'robust-segment-intersect', 'tape', 'delaunator', 'fs', 'path', '@kninnug/constrainautor'],
plugins: [replace({
preventAssignment: true,
values: {
'import.meta.url': function(file){
return JSON.stringify('file://' + file.replace(path.sep, '/'));
}
}
}), typescript()]
}
]
}
export default [
...build('containing-triangle'),
...test('test')
];