diff --git a/lib/module.js b/lib/module.js index 5559cb5..561595d 100644 --- a/lib/module.js +++ b/lib/module.js @@ -54,13 +54,13 @@ module.exports = function module (moduleOptions) { this.extendRoutes(routes => { // Get all static routes and ignore dynamic routes let staticRoutes = flattenRoutes(routes) - .filter(r => !r.includes(':') && !r.includes('*')) + .filter(r => !r.url.includes(':') && !r.url.includes('*')) // Exclude routes options.exclude.forEach(pattern => { const minimatch = new Minimatch(pattern) minimatch.negate = true - staticRoutes = staticRoutes.filter(route => minimatch.match(route)) + staticRoutes = staticRoutes.filter(route => minimatch.match(route.url)) }) // Create a cache for routes @@ -232,7 +232,7 @@ function flattenRoutes (router, path = '', routes = []) { flattenRoutes(r.children, path + r.path + '/', routes) } if (r.path !== '') { - routes.push(path + r.path) + routes.push({ ...r, url: path + r.path }) } }) return routes