@@ -11,6 +11,8 @@ const slugify = require("./src/utils/slugify");
1111const { paginate } = require ( "gatsby-awesome-pagination" ) ;
1212const { createFilePath } = require ( "gatsby-source-filesystem" ) ;
1313const config = require ( "./gatsby-config" ) ;
14+ const isDevelopment = process . env . NODE_ENV === "development" ;
15+ const isProduction = process . env . NODE_ENV === "production" ;
1416const {
1517 componentsData,
1618} = require ( "./src/sections/Projects/Sistent/components/content" ) ;
@@ -57,8 +59,16 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
5759 const { createPage } = actions ;
5860
5961 const envCreatePage = ( props ) => {
62+ const pageConfig = { ...props } ;
63+
64+ if ( isDevelopment ) {
65+ pageConfig . defer = true ;
66+ } else if ( isProduction ) {
67+ pageConfig . mode = "SSR" ;
68+ }
69+
6070 if ( process . env . CI === "true" ) {
61- const { path, matchPath, ...rest } = props ;
71+ const { path, matchPath, ...rest } = pageConfig ;
6272
6373 createRedirect ( {
6474 fromPath : `/${ path } /` ,
@@ -73,7 +83,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
7383 ...rest ,
7484 } ) ;
7585 }
76- return createPage ( props ) ;
86+ return createPage ( pageConfig ) ;
7787 } ;
7888
7989 const blogPostTemplate = path . resolve ( "src/templates/blog-single.js" ) ;
@@ -537,7 +547,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
537547 } ) ;
538548 } ;
539549
540- createComponentPages ( createPage , components ) ;
550+ createComponentPages ( envCreatePage , components ) ;
541551} ;
542552
543553// slug starts and ends with '/' so parts[0] and parts[-1] will be empty
0 commit comments