-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
babel.config.js
56 lines (52 loc) · 1.3 KB
/
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
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
const plugins = [
'@babel/plugin-transform-typescript',
'transform-class-properties',
['@babel/transform-template-literals', {
'loose': true
}],
'@babel/transform-literals',
'@babel/transform-block-scoped-functions',
['@babel/plugin-transform-classes', {
'loose': true
}],
'@babel/transform-sticky-regex',
'@babel/transform-unicode-regex',
'@babel/transform-block-scoping',
['@babel/transform-runtime', {
'regenerator': true
}],
'@babel/proposal-class-properties'
];
let presets = [
[
'@babel/typescript',
{
rewriteImportExtensions: true,
loose: true,
modules: false
}
]
];
// console.log('babel: NODE_ENV: ' + process.env['NODE_ENV']);
if (process.env['NODE_ENV'] === 'es5') {
presets = [
[
'@babel/typescript',
{
rewriteImportExtensions: true,
loose: true,
targets: {
edge: '107',
firefox: '107',
chrome: '108',
safari: '16.2'
},
useBuiltIns: false
}]
];
plugins.unshift('@babel/plugin-transform-modules-commonjs');
}
module.exports = {
presets,
plugins
};