-
Notifications
You must be signed in to change notification settings - Fork 4
/
rollup.config.js
72 lines (65 loc) · 1.37 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
import cjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';
import $package from './package.json';
const input = 'src/index.js';
const external = Object.keys($package.dependencies || []);
const globals = {};
for(let ext of external) {
globals[ext] = ext;
}
var output = function(min) {
return {
file: `dist/v-tostini${(min ? '.min' : '')}.js`,
format: 'umd',
name: 'v-tostini',
banner: `/* v-tostini v${$package.version} ` +
'| (c) Marek Sierociński and contributors ' +
'| https://github.com/marverix/v-tostini/blob/master/LICENSE.md ' +
'*/',
globals
};
};
var plugins = [
cjs(),
resolve(),
babel({
exclude: [/\/core-js\//],
presets: [
[
'@babel/env',
{
targets: '> 2%, Firefox ESR, ie 11, safari 9',
useBuiltIns: 'usage',
corejs: 3,
modules: false
}
]
],
babelHelpers: 'bundled'
})
];
// Export
export default [
// Uncompressed config
{
input,
output: output(),
plugins,
external
},
// Compressed config
{
input,
output: output(true),
plugins: plugins.concat([
terser({
output: {
comments: /license/i
}
})
]),
external
}
];