forked from soapbox-pub/soapbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.cjs
47 lines (43 loc) · 919 Bytes
/
babel.config.cjs
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
module.exports = (api) => {
const env = api.env();
const envOptions = {
debug: false,
modules: false,
useBuiltIns: 'usage',
corejs: '3.27',
};
const config = {
presets: [
'@babel/react',
'@babel/typescript',
['@babel/env', envOptions],
],
plugins: [
['react-intl', { messagesDir: './build/messages/' }],
'preval',
],
'sourceType': 'unambiguous',
};
switch (env) {
case 'production':
config.plugins.push(...[
'@babel/transform-react-inline-elements',
[
'@babel/transform-runtime',
{
helpers: true,
regenerator: false,
useESModules: true,
},
],
]);
break;
case 'test':
config.plugins.push(...[
'transform-require-context',
]);
envOptions.modules = 'commonjs';
break;
}
return config;
};