-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrollup.config.js
80 lines (75 loc) · 2.07 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
79
80
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import { terser } from 'rollup-plugin-terser';
import license from 'rollup-plugin-license';
import { basename } from 'path';
import glob from 'glob';
var builds = module.exports = [];
var output = {
format: 'iife',
name: 'Ravelin',
esModule: false,
// Prevent Object.freeze being used for namespace references.
// https://www.rollupjs.org/guide/en/#outputfreeze.
freeze: false,
// Prevent Object.defineProperty being used for dynamic exports.
// https://www.rollupjs.org/guide/en/#outputexternallivebindings.
externalLiveBindings: false,
};
var plugins = [
replace({
preventAssignment: true,
'RAVELINJS_VERSION': JSON.stringify(require('./package.json').version + '-ravelinjs'),
}),
resolve(),
commonjs(),
license({
banner: `/*! <%= pkg.name %> <%= pkg.version %> - https://github.com/unravelin/ravelinjs. Copyright <%= moment().format('YYYY') %> */`,
}),
];
glob.sync("lib/bundle/*.js")
.sort((a, b) => b.length - a.length)
.forEach(bundle => builds.push(
{
input: bundle,
output: {
file: 'build/ravelin-' + basename(bundle).replace(/\.js$/, '.min.js'),
...output,
},
plugins: plugins.concat([
terser({
compress: {
typeofs: false,
},
ie8: true,
safari10: true,
}),
]),
},
{
input: bundle,
output: {
file: 'build/ravelin-' + basename(bundle),
...output,
},
plugins: plugins,
},
{
input: bundle,
output: {
file: 'dist/' + basename(bundle),
format: 'umd',
name: 'Ravelin',
esModule: false,
exports: 'default',
// Prevent Object.freeze being used for namespace references.
// https://www.rollupjs.org/guide/en/#outputfreeze.
freeze: false,
// Prevent Object.defineProperty being used for dynamic exports.
// https://www.rollupjs.org/guide/en/#outputexternallivebindings.
externalLiveBindings: false,
},
plugins: plugins,
}
));