diff --git a/packages/gatsby/src/cache-dir/root.js b/packages/gatsby/src/cache-dir/root.js index 3896e9c59e20a..c008cc4932877 100644 --- a/packages/gatsby/src/cache-dir/root.js +++ b/packages/gatsby/src/cache-dir/root.js @@ -53,7 +53,13 @@ function shouldUpdateScroll(prevRouterProps, { location: { pathname } }) { return true } -const noMatch = pages.find(r => r.path === `/dev-404-page/`) +let noMatch +for (let i = 0; i < paths.length; i++) { + if (paths[i].path === `/dev-404-page/`) { + noMatch = paths[i] + break + } +} const addNotFoundRoute = () => { if (noMatch) {