-
Notifications
You must be signed in to change notification settings - Fork 12
/
rollup.config.js
55 lines (45 loc) · 1.36 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
// eslint-disable-next-line import/no-extraneous-dependencies
import {terser} from 'rollup-plugin-terser';
import pkg from './package.json';
const year = new Date().getFullYear();
function getBanner(name) {
return `/*!
* ${name} ${pkg.version} - https://photoswipe.com
* (c) ${year} Dmytro Semenov
*/`;
}
function getMinifyPlugin() {
return terser({
output: {
comments: /^\**!/i,
},
mangle: {
properties: {
// mangle properties and func names that start with underscore
regex: /^_/,
}
}
});
}
const outputDir = 'dist/';
const esmDynamicCaptionJS = {
input: 'photoswipe-dynamic-caption-plugin.esm.js',
output: {
name: 'PhotoSwipeDynamicCaption',
banner: getBanner('PhotoSwipe Dynamic Caption plugin'),
file: outputDir + 'photoswipe-dynamic-caption-plugin.esm.min.js',
format: 'esm'
},
plugins: [getMinifyPlugin()]
};
const umdDynamicCaptionJS = {
input: 'photoswipe-dynamic-caption-plugin.esm.js',
output: {
name: 'PhotoSwipeDynamicCaption',
banner: getBanner('PhotoSwipe Dynamic Caption plugin'),
file: outputDir + 'photoswipe-dynamic-caption-plugin.umd.min.js',
format: 'umd'
},
plugins: [getMinifyPlugin()]
};
export default [esmDynamicCaptionJS, umdDynamicCaptionJS];