This repository has been archived by the owner on Sep 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.babelrc.js
84 lines (82 loc) · 1.51 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
const plugins = (env) => ({
cli: [],
default: [
'syntax-dynamic-import',
'syntax-jsx',
'transform-decorators',
'transform-flow-strip-types',
'transform-react-display-name',
'transform-react-jsx'
],
production: [
'syntax-dynamic-import',
'syntax-jsx',
'transform-decorators',
'transform-flow-strip-types',
'transform-react-display-name',
'transform-react-jsx'
],
test: [
'syntax-jsx',
'transform-decorators',
'transform-es2015-modules-commonjs',
'transform-flow-strip-types',
'transform-react-jsx'
]
}[env || 'default'])
const presets = (env) => ({
cli: [
['env', {
targets: {
node: 'current'
}
}]
],
default: [
['env', {
cacheDirectory: true,
debug: true,
modules: false,
useBuiltIns: true,
targets: {
node: 'current',
browsers: [
'> 1%',
'last 2 versions',
'safari >= 7'
]
}
}],
'stage-0'
],
production: [
['env', {
debug: false,
modules: false,
useBuiltIns: true,
targets: {
node: 'current',
browsers: [
'> 1%',
'last 2 versions',
'safari >= 7'
]
}
}],
'stage-0',
'babili'
],
test: [
['env', {
targets: {
node: 'current'
}
}],
'stage-0'
]
}[env || 'default'])
module.exports = {
comments: false,
presets: presets(process.env.NODE_ENV),
plugins: plugins(process.env.NODE_ENV)
}