forked from node-ebml/node-ebml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
31 lines (30 loc) · 968 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
const LTS = 12; // The current oldest LTS supported by Node
module.exports = (api) => {
api.cache.using(() => process.env.NODE_ENV === 'development');
const plugins = [
['@babel/proposal-class-properties', { loose: false }],
'@babel/proposal-export-default-from',
'@babel/proposal-export-namespace-from',
// '@babel/proposal-logical-assignment-operators', // may be activated at a later date
// ['@babel/proposal-optional-chaining', { loose: false }], // may be activated at a later date
];
const presets = [
[
'@babel/env',
{
targets: {
browsers: ['last 2 versions', '> 1%'],
node: api.env('test') ? 'current' : LTS,
},
modules: api.env('test') ? 'commonjs' : false,
useBuiltIns: 'usage',
corejs: 3,
},
],
'@babel/flow',
];
if (api.env('test')) {
return { plugins, presets };
}
return { ignore: ['**/*.test.js'], plugins, presets };
};