forked from emotion-js/emotion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
47 lines (45 loc) · 1.31 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
let pkgsThatNeedBabelPluginEmotion = [
'emotion',
'create-emotion',
'react-emotion',
'jest-emotion',
'emotion-server',
'create-emotion-server',
'emotion-theming'
]
let needsBabelPluginEmotion = filename =>
pkgsThatNeedBabelPluginEmotion.some(pkg =>
filename.includes(`packages/${pkg}/test`)
)
module.exports = api => {
api.cache(true)
return {
presets: ['babel-preset-emotion-dev'],
overrides: [
{
test: filename =>
!filename.includes('no-babel') && needsBabelPluginEmotion(filename),
plugins: ['babel-plugin-emotion-test']
},
{
test: filename =>
filename.includes('auto-label') && needsBabelPluginEmotion(filename),
plugins: [['babel-plugin-emotion-test', { autoLabel: true }]]
},
{
test: filename =>
filename.includes('extract') && needsBabelPluginEmotion(filename),
plugins: [['babel-plugin-emotion-test', { extractStatic: true }]]
},
{
test: filename =>
filename.includes('source-map') && needsBabelPluginEmotion(filename),
plugins: [['babel-plugin-emotion-test', { sourceMap: true }]]
},
{
test: filename => filename.includes('babel-plugin-emotion/test/macro/'),
plugins: ['babel-plugin-macros-register']
}
]
}
}