-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrollup.config.js
61 lines (56 loc) · 1.16 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
import typescript from '@rollup/plugin-typescript';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import htmlTemplate from 'rollup-plugin-generate-html-template';
const lib_cfg = {
input: 'src/index.ts',
external: ['three'],
output: [
{
name: "FastTriangleTriangleIntersection",
format: 'umd',
file: 'build/index.umd.js',
sourcemap: true,
globals: {
'three':'three'
}
},
{
format: 'esm',
file: 'build/index.esm.js',
sourcemap: true,
}
],
plugins: [typescript({
tsconfig: './tsconfig.json',
compilerOptions: {
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"declarationDir": "types",
},
exclude: ["demo/*"]
})]
};
const demo_cfg = {
input: 'demo/intersect.ts',
output: {
file: 'build/demo/intersect.js',
},
plugins: [
typescript({
tsconfig: './tsconfig.json'
}),
nodeResolve(),
htmlTemplate({
template: 'demo/index.html',
target: 'index.html',
}),
]
};
let exported;
if (process.env.demo) {
exported = demo_cfg;
} else {
exported = lib_cfg;
}
export default exported;