Replace Gatsby's default renderer with Emotion's, to ensure correct rendering of Emotion-styled components during SSG.
npm i gatsby-plugin-emotion-ssg
gatsby-plugin-emotion might work for your use case. It might not. This plugin works where that one does not, by replacing the Gatsby SSG renderer, and inlining critical CSS styles. It’s a more heavy-handed approach, but works in almost every use-case.