diff --git a/lib/module.js b/lib/module.js index d5fae603..e53c070b 100644 --- a/lib/module.js +++ b/lib/module.js @@ -38,11 +38,14 @@ function processRoutes () { for (const route of routes) { route.meta = route.meta || {} route.alias = route.alias || [] + if (typeof route.alias === 'string') { + route.alias = [route.alias] + } if (route.path === '/amp' || route.path.indexOf('/amp/') === 0) { route.meta.amp = true } else { - route.alias = '/amp' + route.path + route.alias.push('/amp' + route.path) } } }) diff --git a/test/module.test.js b/test/module.test.js index ed05e0ab..6d046a47 100644 --- a/test/module.test.js +++ b/test/module.test.js @@ -33,7 +33,7 @@ describe('Generates routes', () => { test('Routes should be correctly localized', () => { routes.forEach((route) => { - expect(route.alias).toEqual(`/amp${route.path}`) + expect(route.alias).toEqual([`/amp${route.path}`]) }) }) })