Browse Source
chore: output console error for invalid route component (#5593)
pull/5596/head
Netfan
12 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
8 additions and
6 deletions
-
packages/utils/src/helpers/generate-routes-backend.ts
|
|
|
@ -56,12 +56,14 @@ function convertRoutes( |
|
|
|
// 页面组件转换
|
|
|
|
} else if (component) { |
|
|
|
const normalizePath = normalizeViewPath(component); |
|
|
|
route.component = |
|
|
|
pageMap[ |
|
|
|
normalizePath.endsWith('.vue') |
|
|
|
? normalizePath |
|
|
|
: `${normalizePath}.vue` |
|
|
|
]; |
|
|
|
const pageKey = normalizePath.endsWith('.vue') |
|
|
|
? normalizePath |
|
|
|
: `${normalizePath}.vue`; |
|
|
|
if (pageMap[pageKey]) { |
|
|
|
route.component = pageMap[pageKey]; |
|
|
|
} else { |
|
|
|
console.error(`route component is invalid: ${pageKey}`, route); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return route; |
|
|
|
|