diff --git a/packages/gatsby/cache-dir/ssr-develop-static-entry.js b/packages/gatsby/cache-dir/ssr-develop-static-entry.js index c321d307f0539..c9e7d6c84bbb8 100644 --- a/packages/gatsby/cache-dir/ssr-develop-static-entry.js +++ b/packages/gatsby/cache-dir/ssr-develop-static-entry.js @@ -193,10 +193,20 @@ export default (pagePath, isClientOnlyPage, callback) => { : undefined, } - const pageElement = createElement( - syncRequires.ssrComponents[componentChunkName], - props - ) + let pageElement + if ( + syncRequires.ssrComponents[componentChunkName] && + !isClientOnlyPage + ) { + pageElement = createElement( + syncRequires.ssrComponents[componentChunkName], + props + ) + } else { + // If this is a client-only page or the pageComponent didn't finish + // compiling yet, just render an empty component. + pageElement = () => null + } const wrappedPage = apiRunner( `wrapPageElement`, @@ -276,7 +286,7 @@ export default (pagePath, isClientOnlyPage, callback) => { return bodyHtml } - const bodyStr = isClientOnlyPage ? `` : generateBodyHTML() + const bodyStr = generateBodyHTML() const htmlElement = React.createElement(Html, { ...bodyProps,