-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.babelrc.js
More file actions
29 lines (27 loc) · 815 Bytes
/
.babelrc.js
File metadata and controls
29 lines (27 loc) · 815 Bytes
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
module.exports = function(api) {
const plugins = [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
]
const presets = [
[
'@babel/preset-env',
api.env('es5')
? { forceAllTransforms: true }
: { targets: { node: 'current' } },
],
'@babel/preset-typescript',
]
if (api.env(['test', 'coverage', 'es5'])) {
plugins.push('@babel/plugin-transform-runtime')
}
if (api.env('coverage')) {
plugins.push('babel-plugin-istanbul')
}
return { plugins, presets }
}