-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
70 lines (68 loc) · 1.29 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const makePresets = (isDev) => [
[
'@babel/preset-env',
{
targets: {
ie: '11',
edge: '18',
firefox: '60',
chrome: '67',
safari: '11.1',
},
},
],
'@babel/preset-react',
'@babel/preset-typescript',
[
'@emotion/babel-preset-css-prop',
{
sourceMap: isDev,
autoLabel: 'dev-only',
labelFormat: '[local]',
cssPropOptimization: !isDev,
},
],
];
const makePlugins = (isDev) => [
'macros',
[
'@babel/plugin-proposal-class-properties',
{
loose: isDev,
},
],
'@babel/proposal-object-rest-spread',
[
'@babel/plugin-proposal-private-methods',
{
loose: isDev,
},
],
[
'@babel/plugin-proposal-private-property-in-object',
{
loose: isDev,
},
],
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-optional-chaining',
];
module.exports = {
env: {
// used for bundling storybook
production: {
presets: makePresets(true),
plugins: makePlugins(true),
},
// used for compiling core
release: {
presets: makePresets(false),
plugins: makePlugins(false),
},
// used for storybook / development
development: {
presets: makePresets(true),
plugins: makePlugins(true),
},
},
};