diff --git a/lib/build/index.js b/lib/build/index.js index 80cb7c37d0..20e7bf14a8 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -232,10 +232,10 @@ function cleanChildrenRoutes (routes, isChild = false) { let isOptional = true routes.forEach((route) => { route.path = (isChild) ? route.path.replace('/', '') : route.path - if (route.path === '') { + if (route.path === '' || route.path === '/') { isOptional = false } - if (isChild && isOptional && route.path.includes(':')) { + if (isOptional && route.path.includes(':')) { route.path += '?' } if (route.children) {