diff --git a/lib/isomorphic/create-routes.js b/lib/isomorphic/create-routes.js index a03e3ea5575df..7d3b2a3137d97 100644 --- a/lib/isomorphic/create-routes.js +++ b/lib/isomorphic/create-routes.js @@ -20,6 +20,7 @@ module.exports = (files, pagesReq) => { pages, templates, } + let notFound = null const templatesHash = {} templatesHash.root = routes templatesHash['/'] = routes @@ -159,7 +160,22 @@ module.exports = (files, pagesReq) => { parentTemplateFile, }) } + + if (includes(page.path, '/404')) { + notFound = { + path: '*', + component: handler, + page, + pages, + templates, + parentTemplateFile, + } + } }) + if (notFound) { + routes.childRoutes.push(notFound) + } + return routes }