-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
babel.config.js
46 lines (42 loc) · 1.04 KB
/
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
module.exports = function (api) {
api.cache(true);
const noModules = String(process.env.BABEL_NO_MODULES) === 'true';
const rename = {};
const mangle = require('./mangle.json');
for (let prop in mangle.props.props) {
let name = prop;
if (name[0] === '$') {
name = name.slice(1);
}
rename[name] = mangle.props.props[prop];
}
return {
presets: [
[
'@babel/preset-env',
{
loose: true,
// Don't transform modules when using esbuild
modules: noModules ? false : 'auto',
exclude: ['@babel/plugin-transform-typeof-symbol'],
targets: {
browsers: ['last 2 versions', 'IE >= 9']
}
}
]
],
plugins: [
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-react-jsx',
'babel-plugin-transform-async-to-promises',
['babel-plugin-transform-rename-properties', { rename }]
],
include: ['**/src/**/*.js', '**/test/**/*.js'],
overrides: [
{
test: /(component-stack|debug)\.test\.js$/,
plugins: ['@babel/plugin-transform-react-jsx-source']
}
]
};
};