microapps / gatsby-plugin-react-i18next

Easily translate your Gatsby website into multiple languages
MIT License
121 stars 72 forks source link

Gatsby Build Fail #140

Open ldw510 opened 2 years ago

ldw510 commented 2 years ago

Hello,

Running the plug-in on my local server fine. Everything works as it should.

However, when I go to push to Netlify using a build command I get these error codes:

:error Page data from page-data.json for the failed page

:failed Building static HTML for pages - 4.555s :error "document" is not available during server side rendering.

Any ideas what the problem is?

passion4code commented 2 years ago

This is a common issue not related to this plugin. You'll want to put a check around each usage of the document object, like this

if (typeof document === 'undefined') {
 return;
}

When gatsby is preparing your items in the build process, the document is not available (as it is supplied by the browser and there is no mock document injected in the build process).

I hope that helps.