-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathrollup.config.js
42 lines (29 loc) · 931 Bytes
/
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
import path from 'path';
const files = {
URDFLoader: 'URDFLoader.js',
URDFViewer: 'urdf-viewer-element.js',
URDFManipulator: 'urdf-manipulator-element.js',
};
const isExternal = p => {
return !!(/^three/.test(p) || Object.values(files).filter(f => p.indexOf(f) !== -1).length);
};
export default [
// libraries
...Object.entries(files).map(([name, file]) => {
const inputPath = path.join(__dirname, `./src/${ file }`);
const outputPath = path.join(__dirname, `./umd/${ file }`);
return {
input: inputPath,
treeshake: false,
external: p => isExternal(p),
output: {
name,
extend: true,
format: 'umd',
file: outputPath,
sourcemap: true,
globals: path => /^three/.test(path) ? 'THREE' : null,
},
};
}),
];