jxnblk / mdx-go

:zap: Lightning fast MDX-based dev server for progressive documentation

Home Page:https://mdx-go.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: window is not defined when building

sublayerio opened this issue · comments

Hi Brent,

Great piece of work. Upon building I get the error ReferenceError: window is not defined when using the window object. It's not obvious what might cause this, I guess it's related to the server side render when building.

Hi! Do the components or modules you're using try to access with window object outside of the React component lifecycle?

I moved the usage of the window to the componentDidMount function and it fixed the issue, thanks!