-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrollup.config.js
89 lines (87 loc) · 2.28 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
81
82
83
84
85
86
87
88
89
const nodeResolve = require('@rollup/plugin-node-resolve')
const resolve = ("function" === typeof nodeResolve )?nodeResolve:nodeResolve.nodeResolve;
const commonjs = require('@rollup/plugin-commonjs')
//const closure = require('rollup-plugin-closure-compiler' );
const terser = require('@rollup/plugin-terser')
//const gzip = require( 'rollup-plugin-gzip').default
const pkg = require('./package.json')
// Last time through gzip plugin refused to write compressed output.
module.exports = [
// ES6 Modules Non-minified
{
input: 'lib/index.js',
output: {
file: pkg.browser.replace(/\.js$/, '.mjs'),
format: 'esm',
},
plugins: [
resolve(),//.nodeResolve(),
commonjs(),
],
},
// ES6 Modules Minified
{
input: 'lib/index.js',
output: {
file: pkg.browser.replace(/\.js$/, '.min.mjs'),
format: 'esm',
},
plugins: [
resolve(),//.nodeResolve(),
commonjs(),
terser( ),
],
},
// ES6 Modules Minified
{
input: pkg.module,
output: {
file: pkg.module.replace(/\.mjs$/, '.min.mjs'),
exports : 'named',
format: 'esm',
},
plugins: [
commonjs(),
terser(),
],
},
// ES6 NonModule Minified
{
input: pkg.main,
output: {
file: pkg.main.replace(/\.js$/, '.min.js'),
//exports : 'default',
format: 'cjs',
},
plugins: [
commonjs(),
terser( {toplevel:false,mangle:{reserved :["exports"], properties:{undeclared :false, reserved :["begin","JSOX","exports"]}} } ),
],
},
/*
// ES6 Modules Minified
{
input: pkg.module.replace(/\.mjs$/, '.min.mjs'),
output: {
file: pkg.module.replace(/\.mjs$/, '.min.mjs.gz'),
exports : 'named',
format: 'esm',
},
plugins: [
gzip(),
],
},
// ES6 NonModule Minified
{
input: pkg.main.replace(/\.js$/, '.min.js'),
output: {
file: pkg.main.replace(/\.js$/, '.min.js.gz'),
exports : 'named',
format: 'cjs',
},
plugins: [
gzip(),
],
},
*/
]