Skip to content

Commit efe12c1

Browse files
committed
fix(alita): 修复window平台下 usingComponents路径错误
1 parent 228620d commit efe12c1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/extractWxCompFiles/copyPackageWxComponents.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function getRelativeChunks(moduleInfos, dirname) {
9696
for(let i = 0; i < allModuleRes.length; i ++) {
9797
const res = allModuleRes[i]
9898

99-
if (res.includes(`${dirname}/`)) {
99+
if (res.includes(`${dirname}${path.sep}`)) {
100100
moduleInfos[res].chunks.forEach(c => {
101101
chunks.add(c)
102102
})

src/extractWxCompFiles/extractJSONFile.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ function getFinalPath(element, source, module, info, defaultSpecifier, chunk, js
128128
let requireDefault = true
129129
if (source === 'react-native') {
130130
requireAbsolutePath = getCompPath(chunk, source, `WX${element}`)
131+
requireAbsolutePath = path.resolve(configure.inputFullpath, '.' + requireAbsolutePath)//configure.inputFullpath + (requireAbsolutePath .replace(/\\/g, '/'))
131132
jsonRelativeFiles.add(source)
132133
} else if (judgeLibPath(source) && source === getLibPath(source) && getCompPath(chunk, source, element)) {
133134
requireAbsolutePath = getCompPath(chunk, source, element)
135+
requireAbsolutePath = path.resolve(configure.inputFullpath, '.' + requireAbsolutePath)
134136
jsonRelativeFiles.add(source)
135137
} else {
136138
const deepSeekResult = deepSeekPath(element, info.deps[source], defaultSpecifier, chunk)
@@ -143,7 +145,8 @@ function getFinalPath(element, source, module, info, defaultSpecifier, chunk, js
143145
if (chunk !== '_rn_') {
144146
const subpageDir = chunk.replace('/_rn_', '')
145147
module = module
146-
.replace(configure.inputFullpath, configure.inputFullpath + '/' + subpageDir)
148+
.replace(configure.inputFullpath, configure.inputFullpath + path.sep + subpageDir)
149+
147150
}
148151

149152
let sp = shortPath(requireAbsolutePath, module)

0 commit comments

Comments
 (0)