-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbabel.config.js
More file actions
48 lines (45 loc) · 827 Bytes
/
babel.config.js
File metadata and controls
48 lines (45 loc) · 827 Bytes
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
module.exports = (api) => {
const env = api.env();
const test = env === 'test';
const presets = [
[
'@babel/preset-env',
{
spec: false,
loose: true,
useBuiltIns: 'usage',
corejs: 3,
targets: {
esmodules: true,
},
modules: test && 'auto',
},
],
];
const plugins = [
[
'@babel/plugin-proposal-class-properties',
{
loose: true,
},
],
[
'@babel/plugin-proposal-object-rest-spread',
{
loose: true,
useBuiltIns: true,
},
],
test && ['@babel/plugin-transform-runtime'],
test && [
'babel-plugin-istanbul',
{
exclude: ['**/*.spec.js'],
},
],
];
return {
presets,
plugins: plugins.filter(Boolean),
};
};