diff --git a/core/docz-core/templates/gatsby-config.tpl.js b/core/docz-core/templates/gatsby-config.tpl.js index 57a70a132..b87296289 100644 --- a/core/docz-core/templates/gatsby-config.tpl.js +++ b/core/docz-core/templates/gatsby-config.tpl.js @@ -1,10 +1,18 @@ const { mergeWith } = require('lodash/fp') +const fs = require('fs-extra') -let custom -try { - custom = require('./gatsby-config.custom') -} catch(err) { - custom = {} +let custom = {} +const hasGatsbyConfig = fs.existsSync('./gatsby-config.custom.js') + +if (hasGatsbyConfig) { + try { + custom = require('./gatsby-config.custom') + } catch (err) { + console.error( + `Failed to load your gatsby-config.js file : `, + JSON.stringify(err) + ) + } } const config = {