Skip to content

Commit e84f671

Browse files
authored
fix: 修复编译单个组件在小程序下路径异常的问题 (#3215)
1 parent bd9f30b commit e84f671

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/harmony/update-taro-entry.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ const isShow = (item) => {
2121

2222
// 更新 app.config.ts 文件
2323
const createConfig = async () => {
24-
const configRef = []
24+
let configRef = []
2525

2626
return new Promise((res, rej) => {
2727
config.nav.map((item) => {
2828
let co = {
2929
root: item.enName,
3030
pages: [],
3131
}
32-
if(paramG) {
33-
if(paramG === item.enName){
32+
if (paramG) {
33+
if (paramG === item.enName) {
3434
item.packages.map((it) => {
3535
if (isShow(it)) {
3636
co.pages.push(`pages/${it.name.toLowerCase()}/index`)
@@ -49,6 +49,10 @@ const createConfig = async () => {
4949
co = { ...co, pages: co.pages.sort() }
5050
configRef.push(co)
5151
})
52+
53+
// 如果 pages 数据为空,则删除该项
54+
configRef = configRef.filter((item) => item.pages.length !== 0)
55+
5256
res(configRef)
5357
})
5458
}

0 commit comments

Comments
 (0)