-
Notifications
You must be signed in to change notification settings - Fork 22
/
rollup.config.js
60 lines (50 loc) · 1.41 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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import cleanup from 'rollup-plugin-cleanup';
const extensions = [
'.ts'
];
function ON_WARN(warning, rollupWarn) {
if (warning.code === 'CIRCULAR_DEPENDENCY') {
warning.cycle.forEach((c) => {
if (c.endsWith("index.ts")) {
throw new Error(warning.message)
}
})
console.log(warning.message)
}
}
// package list is stored in package.json
const packages = require("./package.json").packages
// as are names for the packages.
const packageNames = require("./package.json").packageNames
const out = []
out.push({
input: `./ts/index.ts`,
output: [
{
name: "jsPlumb",
file: `dist/browser-ui/js/jsplumb.browser-ui.cjs.js`,
format: 'cjs'
},
{
name: "jsPlumb",
file: `dist/browser-ui/js/jsplumb.browser-ui.es.js`,
format: 'es'
},
{
name: "jsPlumb",
file: `dist/browser-ui/js/jsplumb.browser-ui.umd.js`,
format: 'umd'
}
],
plugins: [
resolve({ extensions }),
commonjs(),
babel({ extensions, include: [`ts/**/*`], babelHelpers:"bundled" }),
cleanup({ extensions:['ts', 'js']})
],
onwarn:ON_WARN
})
export default out