-
-
Notifications
You must be signed in to change notification settings - Fork 446
/
.babelrc.js
48 lines (43 loc) · 1.04 KB
/
.babelrc.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
'use strict';
const target = process.env.BABEL_TARGET;
const output = process.env.BABEL_OUTPUT;
const env = process.env.NODE_ENV;
const modules = output == null ? false : output;
const targets = env === 'test' ? { node: 'current' } : undefined;
const options = {
comments: false,
minified: true,
assumptions: {
ignoreToPrimitiveHint: true,
iterableIsArray: true,
mutableTemplateObject: true,
noNewArrows: true,
objectRestNoSymbols: true,
setComputedProperties: true,
setSpreadProperties: true,
},
presets: [
[
'@babel/env',
{
bugfixes: true,
loose: true,
modules,
targets,
corejs: '3',
useBuiltIns: 'entry',
},
],
['@babel/react', { useBuiltIns: true }],
],
plugins: [],
};
if (target === 'examples') {
options.plugins.push([
'transform-react-remove-prop-types',
{ removeImport: true },
]);
} else if (env !== 'test') {
options.plugins.push(['transform-react-remove-prop-types', { mode: 'wrap' }]);
}
module.exports = options;