-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.js
57 lines (51 loc) · 1.39 KB
/
rollup.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
const path = require('path');
const rollup = require('rollup');
const { babel } = require('@rollup/plugin-babel');
const { terser } = require('rollup-plugin-terser');
const useES5 = process.argv.includes('--es5');
const plugins = useES5
? [
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled'
}),
terser({
output: {
comments: function(node, comment) {
var text = comment.value;
var type = comment.type;
if (type == "comment2") {
// multiline comment
return /@preserve|@license|@cc_on/i.test(text);
}
}
}
})
]
: [
terser({
output: {
comments: function(node, comment) {
var text = comment.value;
var type = comment.type;
if (type == "comment2") {
// multiline comment
return /@preserve|@license|@cc_on/i.test(text);
}
}
}
})
];
const filename = useES5 ? 'rekishi.es5.js' : 'rekishi.js';
async function build() {
const bundle = await rollup.rollup({
input: path.join(__dirname,'/src/rekishi.js'),
plugins
});
await bundle.write({
format: 'umd',
name: 'rekishi',
file: path.join(__dirname, `/dist/${filename}`)
});
};
build();