Commit 74fd254c authored by 前端-许佳敏's avatar 前端-许佳敏

chore: 处理菜单校验在windows下的路径错误

parent 9dec2ec7
...@@ -16,7 +16,7 @@ function validateRouterJson(json, testLocalJson) { ...@@ -16,7 +16,7 @@ function validateRouterJson(json, testLocalJson) {
// 本地的json // 本地的json
while(dispatchs.length) { while(dispatchs.length) {
const item = dispatchs.shift() const item = dispatchs.shift()
hashMapReSource[item.replace(process.cwd(), '')] = true hashMapReSource['/' + item.substring(item.indexOf('src')).replace(/\\/g, '/')] = true
dispatchs.push(...dispatchDir(item, excludes)) dispatchs.push(...dispatchDir(item, excludes))
} }
} }
...@@ -25,7 +25,7 @@ function validateRouterJson(json, testLocalJson) { ...@@ -25,7 +25,7 @@ function validateRouterJson(json, testLocalJson) {
function transformJson(json) { function transformJson(json) {
return Array.isArray(json) ? json.reduce((target, maps) => { return Array.isArray(json) ? json.reduce((target, maps) => {
if (maps.component) { if (maps.component) {
target[maps.component.replace('@', resourcePath).replace('./', resourcePath + '/pages/').replace(process.cwd(), '')] = true target[maps.component.replace('@', '/src').replace('./', '/src/pages/')] = true
} }
if (maps.routes) { if (maps.routes) {
target = Object.assign(target, transformJson(maps.routes)) target = Object.assign(target, transformJson(maps.routes))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment