forked from bbc/simorgh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.babelrc.js
60 lines (57 loc) · 1.41 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
49
50
51
52
53
54
55
56
57
58
59
60
var plugins = [
'@emotion',
'@babel/plugin-proposal-object-rest-spread', // allows ...spread notation
'@babel/plugin-syntax-dynamic-import', // allows `await import()` syntax
'@babel/plugin-transform-runtime',
'@loadable/babel-plugin',
];
// allows dynamic `import()` in Node tests.
if (process.env.NODE_ENV === 'test') {
plugins.push('dynamic-import-node');
plugins.push('@babel/plugin-proposal-throw-expressions'); // allows `throw new Error();`
}
if (process.env.NODE_ENV === 'production') {
plugins.push([
'transform-react-remove-prop-types',
{
mode: 'remove',
removeImport: true,
},
]);
}
module.exports = {
presets: [
[
'@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',
],
node: 'current',
},
// analyses code & polyfills only the features that are used, only for the targeted browsers
useBuiltIns: 'usage',
corejs: '3',
},
],
'@babel/preset-react', // transform JSX to JS
],
plugins: plugins,
overrides: [
{
test: /.*logger\..*/,
sourceType: 'script',
},
],
};