forked from mverissimo/emotion-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
55 lines (51 loc) · 959 Bytes
/
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
const isProd = process.env.NODE_ENV === 'production';
module.exports = (api) => {
api.cache(true);
const presets = [
'@babel/preset-typescript',
[
'@babel/preset-env',
{
loose: true,
targets: {
esmodules: !isProd,
},
},
],
isProd && [
'@babel/preset-react',
{
runtime: 'automatic',
importSource: '@emotion/react',
},
],
!isProd && [
'@babel/preset-react',
{
development: true,
runtime: 'automatic',
importSource: '@emotion/react',
},
],
!isProd && [
'@emotion/babel-preset-css-prop',
{
labelFormat: '[filename]--[local]',
},
],
].filter(Boolean);
const plugins = [
'lodash',
isProd && [
'@emotion',
{
sourceMap: false,
autoLabel: 'never',
},
],
].filter(Boolean);
return {
presets,
plugins,
};
};