diff --git a/packages/gatsby-plugin-typography/src/gatsby-node.js b/packages/gatsby-plugin-typography/src/gatsby-node.js index 7c210bec66d2b..4d5e4c3329fca 100644 --- a/packages/gatsby-plugin-typography/src/gatsby-node.js +++ b/packages/gatsby-plugin-typography/src/gatsby-node.js @@ -19,5 +19,11 @@ const typography = new Typography() module.exports typography` } - fs.writeFileSync(`${__dirname}/.cache/typography.js`, module) + const dir = `${__dirname}/.cache` + + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir) + } + + fs.writeFileSync(`${dir}/typography.js`, module) }