Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function patchRoute(route, pagesPath, parentRoutePath) {
// clone 是为了避免 patch 多次
route = clone(route);
// route.component start from pages
if (route.component) {
route.component = resolveComponent(pagesPath, route.component);
}
// path patch must be before bigfish patch
if (route.path && route.path.charAt(0) !== '/') {
if (isUrl(route.path)) {
route.path = winPath(route.path);
} else {
route.path = winPath(join(parentRoutePath, route.path));
}
}
// Compatible with bigfish
if (process.env.BIGFISH_COMPAT) {
if (route.childRoutes) {
route.routes = route.childRoutes;
delete route.childRoutes;
}
if (route.indexRoute) {
if (route.indexRoute.redirect) {
let { redirect } = route.indexRoute;
if (redirect.charAt(0) !== '/') {