-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
47 lines (44 loc) · 1015 Bytes
/
babel.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
module.exports = function (api) {
const env = api.env();
switch (env) {
case 'test':
return testConfig;
case 'esm':
return getConfig({ modules: false });
case 'cjs':
return getConfig({ modules: 'cjs' });
default:
return getConfig({ modules: 'auto' });
}
};
function getConfig({ modules }) {
return {
presets: [
[
'@babel/preset-env',
{
modules: modules,
targets: '> 0.5%, not dead',
},
],
'@babel/preset-react',
],
plugins: ['@babel/plugin-transform-runtime'],
};
}
const testConfig = {
presets: [
[
'@babel/preset-env',
{
targets: { node: 'current' },
},
],
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
],
};