-
Notifications
You must be signed in to change notification settings - Fork 466
/
rollup.config.js
69 lines (67 loc) · 1.29 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
const babel = require('@rollup/plugin-babel');
const changeCase = require('change-case');
const commonjs = require('@rollup/plugin-commonjs');
const createBanner = require('create-banner');
const nodeResolve = require('@rollup/plugin-node-resolve');
const terser = require('@rollup/plugin-terser');
const pkg = require('./package.json');
const name = changeCase.pascalCase(pkg.name);
const banner = createBanner({
case: 'PascalCase',
data: {
year: '2014-present',
},
template: 'inline',
});
const globals = {
jquery: 'jQuery',
};
module.exports = {
input: 'src/index.js',
output: [
{
banner,
name,
globals,
file: pkg.browser,
format: 'umd',
},
{
banner,
name,
file: pkg.browser.replace(/(\.js)$/, '.min$1'),
globals,
format: 'umd',
compact: true,
plugins: [
terser(),
],
},
{
banner,
file: pkg.main,
format: 'cjs',
exports: 'auto',
},
{
banner,
file: pkg.module,
format: 'esm',
},
{
banner,
name,
globals,
file: pkg.browser.replace(/^dist/, 'docs/js'),
format: 'umd',
},
],
external: ['jquery'],
plugins: [
nodeResolve(),
commonjs(),
babel({
babelHelpers: 'bundled',
}),
],
};