-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbabel.config.js
42 lines (42 loc) · 1.04 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
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
['taro', {
framework: 'react',
ts: true
}]
],
plugins: [
[
'import',
{
libraryName: 'taro-ui',
customName: name => {
if(name === 'at-list-item'){
name = 'at-list/item'
} else if(name === 'at-action-sheet-item'){
name = 'at-action-sheet/body/item'
}
return `taro-ui/lib/components/${name.slice(3)}`
},
customStyleName: name => {
/**
* 修复style
*/
if(name === 'at-tabs-pane'){
name = 'at-tabs'
}
else if(name === 'at-list-item'){
name = 'at-list'
}
else if(name === 'at-action-sheet-item'){
name = 'at-action-sheet'
}
return `taro-ui/dist/style/components/${name.slice(3)}.scss`
}
},
'taro-ui'
]
]
}