This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
105 lines (102 loc) · 2.67 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
99
100
101
102
103
104
105
import resolve from '@rollup/plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import {terser} from "rollup-plugin-terser";
import clear from "rollup-plugin-clear";
const babelOptionsES5 = {
runtimeHelpers: false,
externalHelpers: false,
babelrc: false,
presets: [
[
"@babel/env",
{
targets: {
ie: '11',
edge: '17',
firefox: '60',
chrome: '71',
safari: '11.1',
},
}
]
],
plugins: [
["@babel/plugin-proposal-class-properties", {loose: true}],
["@babel/plugin-proposal-private-property-in-object", {loose: true}],
["@babel/plugin-proposal-private-methods", { loose: true }],
]
};
const babelOptionsES2018 = {
runtimeHelpers: false,
externalHelpers: false,
babelrc: false,
plugins: [
["@babel/plugin-proposal-class-properties", {loose: true}],
["@babel/plugin-proposal-private-property-in-object", {loose: true}],
["@babel/plugin-proposal-private-methods", { loose: true }],
]
};
// https://rollupjs.org/guide/en#big-list-of-options
export default [
// ES2015 Minified
{
input: './src/index.js',
output: {
file: './dist/observer.min.js',
format: 'umd',
name: 'ObjectObserver',
compact: true,
sourcemap: true,
},
plugins: [
resolve(),
clear({targets: ['./dist']}),
babel(babelOptionsES5),
terser(),
]
},
// ES2015 None-Minified
{
input: './src/index.js',
output: {
file: './dist/observer.js',
format: 'umd',
name: 'ObjectObserver',
compact: false,
sourcemap: true,
},
plugins: [
resolve(),
babel(babelOptionsES5),
]
},
// ES Modules Minified
{
input: './src/index.js',
output: {
file: './dist/observer.esm.min.js',
format: 'esm',
compact: true,
sourcemap: true,
},
plugins: [
resolve(),
babel(babelOptionsES2018),
terser(),
]
},
// ES Modules None-Minified
{
input: './src/index.js',
output: {
file: './dist/observer.esm.js',
format: 'esm',
compact: false,
sourcemap: true,
},
plugins: [
resolve(),
babel(babelOptionsES2018),
]
},
];