forked from bbc/web-vitals
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
61 lines (59 loc) · 1.36 KB
/
rollup.config.js
File metadata and controls
61 lines (59 loc) · 1.36 KB
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
const babel = require('@rollup/plugin-babel');
const terser = require('@rollup/plugin-terser');
const autoExternal = require('rollup-plugin-auto-external');
const configurePlugins = ({ module }) => {
return [
autoExternal(),
babel({
babelHelpers: 'bundled',
presets: [
'@babel/preset-react',
[
'@babel/preset-env',
{
targets: {
browsers: [
'chrome >= 53',
'firefox >= 45.0',
'ie >= 11',
'edge >= 37',
'safari >= 9',
'opera >= 40',
'op_mini >= 18',
'Android >= 7',
'and_chr >= 53',
'and_ff >= 49',
'ios_saf >= 10',
],
},
modules: module ? 'auto' : false,
},
],
],
plugins: ['dynamic-import-node', 'babel-plugin-add-import-extension'],
}),
terser({
module,
mangle: true,
compress: true,
}),
];
};
module.exports = [
{
input: 'src/index.js',
output: {
format: 'cjs',
file: './dist/cjs.js',
},
plugins: configurePlugins({ module: false }),
},
{
input: 'src/index.js',
output: {
format: 'esm',
file: './dist/esm.js',
},
plugins: configurePlugins({ module: true }),
},
];