Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit fe1e2da

Browse files
committed
fix(docz-core): log errors that happen in gatsby-config
1 parent c0dc74d commit fe1e2da

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

‎core/docz-core/templates/gatsby-config.tpl.js‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
const { mergeWith } = require('lodash/fp')
2+
const fs = require('fs-extra')
23

3-
let custom
4-
try {
5-
custom = require('./gatsby-config.custom')
6-
} catch(err) {
7-
custom = {}
4+
let custom = {}
5+
const hasGatsbyConfig = fs.existsSync('./gatsby-config.custom.js')
6+
7+
if (hasGatsbyConfig) {
8+
try {
9+
custom = require('./gatsby-config.custom')
10+
} catch (err) {
11+
console.error(
12+
`Failed to load your gatsby-config.js file : `,
13+
JSON.stringify(err)
14+
)
15+
}
816
}
917

1018
const config = {

0 commit comments

Comments
 (0)