Skip to content

Commit 673aa7b

Browse files
committed
fix(runner): 修復 wins 端入口文件名判斷
1 parent b14b8a7 commit 673aa7b

File tree

1 file changed

+6
-0
lines changed
  • packages/taro-vite-runner/src/harmony

1 file changed

+6
-0
lines changed

packages/taro-vite-runner/src/harmony/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi
195195
name = chunkInfo.name
196196
}
197197

198+
name = name.replace(/[\\/]+/g, '/')
199+
198200
const appId = viteCompilerContext.app.config.appId || 'app'
199201
const isTaroComp = appId === name || viteCompilerContext.pages.some(page => page.name === name) || viteCompilerContext.components?.some(comp => comp.name === name)
200202
// 如果同时存在app.ets和app.js,因为鸿蒙IDE编译会把app.ets编译成app.ts,会跟app.js冲突,识别都是/app,导致app.js被app.ts覆盖了,所以需要名字
@@ -205,6 +207,10 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi
205207
name += QUERY_IS_NATIVE_SCRIPT
206208
}
207209

210+
if (name.startsWith('.')) {
211+
name = name.replace(/^\.[.\\/]+/, '')
212+
}
213+
208214
return name
209215
},
210216
chunkFileNames(chunkInfo) {

0 commit comments

Comments
 (0)