-
Notifications
You must be signed in to change notification settings - Fork 84
/
rollup.config.js
98 lines (94 loc) · 1.94 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
90
91
92
93
94
95
96
97
98
import babel from 'rollup-plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import {uglify} from 'rollup-plugin-uglify';
import {terser} from 'rollup-plugin-terser';
import multi from '@rollup/plugin-multi-entry';
const ROLLUP_LEGACY = {
exclude: 'node_modules/**',
babelrc: false,
presets: [
[
"@babel/env",
{
"targets": {
"browsers": [
"> 0.5%, last 2 versions, Firefox ESR, not dead"
]
},
"useBuiltIns": "usage",
"corejs": 3,
"exclude": [
'es.regexp.exec',
'es.string.split',
]
}
],
],
};
const ROLLUP_MODERN = {
exclude: 'node_modules/**',
babelrc: false,
presets:
[
[
"@babel/env",
{
"targets": ["defaults",
"not ie >= 0"],
"debug": true,
"useBuiltIns": "usage",
"corejs": 3,
"exclude": [
"es.string.split"
]
}
]
],
};
let all_coverage = {
'assets/js/build/all/metabox.js': 'assets/js/src/metabox.js',
'assets/js/build/all/gutenberg.js': 'assets/js/src/gutenberg.js',
'assets/js/build/all/customizer-preview.js': ['assets/js/src/customizer-preview/app.js'],
'assets/js/build/all/customizer-controls.js': ['./assets/customizer/js/*.js']
},
__export = [],
modern = {
'assets/js/build/modern/shop.js': 'assets/js/src/shop/app.js',
'assets/js/build/modern/frontend.js': 'assets/js/src/frontend/app.js',
};
Object.keys(all_coverage).forEach(function (item) {
__export.push({
input: all_coverage[item],
output: {
file: item,
format: 'iife',
sourceMap: 'inline'
},
plugins: [
multi(),
resolve(),
commonjs(),
babel(ROLLUP_LEGACY),
uglify()
]
});
});
Object.keys(modern).forEach(function (item) {
__export.push({
input: modern[item],
output: {
file: item,
format: 'iife',
sourceMap: 'inline'
},
plugins: [
multi(),
resolve(),
commonjs(),
babel(ROLLUP_MODERN),
terser()
]
});
});
export default __export;