-
Notifications
You must be signed in to change notification settings - Fork 37
/
.babelrc.js
57 lines (53 loc) · 1.17 KB
/
.babelrc.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
57
const { BABEL_ENV } = process.env
const isBundling = BABEL_ENV === 'bundle'
const sharedPresets = ['@babel/typescript']
const shared = {
presets: sharedPresets,
plugins: [['@babel/plugin-proposal-class-properties', { loose: true }]],
}
!isBundling && shared.plugins.push('@babel/plugin-transform-runtime')
module.exports = {
env: {
esm: {
...shared,
presets: [
[
'@babel/env',
{
targets: 'chrome 79, last 1 edge version, last 1 safari version, last 1 firefox version, node 14',
modules: false,
},
],
...sharedPresets,
],
plugins: [...shared.plugins, 'babel-plugin-add-import-extension'],
},
bundle: {
...shared,
presets: [
[
'@babel/env',
{
targets: '> 0.5%, last 2 versions, not dead, not IE 11',
},
],
...sharedPresets,
],
},
cjs: {
...shared,
presets: [
[
'@babel/env',
{
modules: 'commonjs',
targets: {
node: '10.0',
},
},
],
...sharedPresets,
],
},
},
}