babel.config.js
761 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
30
31
32
33
34
35
36
37
38
module.exports = api => {
api.cache(true);
return {
presets: [
[
'@babel/env',
{
useBuiltIns: 'usage'
}
]
],
plugins: [
'@babel/proposal-class-properties',
'@babel/syntax-object-rest-spread',
process.env.BABEL_ENV !== 'module' && 'add-module-exports',
[
'transform-inline-environment-variables',
{ include: ['BABEL_ENV', 'ENV'] }
]
].filter(Boolean),
env: {
test: {
plugins: ['istanbul']
},
development: {
plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter(
Boolean
)
},
module: {
presets: [['@babel/env', { modules: false }]]
}
}
};
};