Skip to content

Commit

Permalink
fix: Remove pages/ prefix for routes aliases options
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgv committed Jan 26, 2018
1 parent f2f8cc8 commit c26cf16
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ const generateRoutes = ({

localizedRoutes.forEach(baseRoute => {
locales.forEach((locale) => {
const { component } = baseRoute
let { path, name, children, chunkName } = baseRoute
const { component, chunkName } = baseRoute
let { path, name, children } = baseRoute
const cleanChunkName = chunkName.replace(/^pages\//, '');
if (children) {
children = generateRoutes({
baseRoutes: children,
Expand All @@ -46,8 +47,8 @@ const generateRoutes = ({
})
}
const { code } = locale
if (has(routesOptions, `${chunkName}.${code}`)) {
path = routesOptions[chunkName][code]
if (has(routesOptions, `${cleanChunkName}.${code}`)) {
path = routesOptions[cleanChunkName][code]
}
// Don't change path when current route is a child
if (code !== defaultLocale && !isChild) {
Expand Down

0 comments on commit c26cf16

Please sign in to comment.