You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/debugging-html-builds.md
+39-12Lines changed: 39 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,18 @@
2
2
title: Debugging HTML Builds
3
3
---
4
4
5
-
Errors while building static HTML files generally happen for one of the following reasons:
6
-
7
-
1. Some of your code references "browser globals" like `window` or `document`. If
8
-
this is your problem you should see an error above like "window is not
9
-
defined". To fix this, find the offending code and either a) check before
10
-
calling the code if window is defined so the code doesn't run while Gatsby is
11
-
building (see code sample below) or b) if the code is in the render function
12
-
of a React.js component, move that code into a [`componentDidMount` lifecycle](https://reactjs.org/docs/react-component.html#componentdidmount) or into a [`useEffect` hook](https://reactjs.org/docs/hooks-reference.html#useeffect), which
5
+
Errors while building static HTML files (The build-time React SSR process) generally happen for one of the following reasons:
6
+
7
+
1. Some of your code references "browser globals" like `window` or `document`
8
+
that aren't available in Node.js. If this is your problem you should see an
9
+
error above like "window is not defined". To fix this, find the offending
10
+
code and either a) check before calling the code if window is defined so the
11
+
code doesn't run while Gatsby is building (see code sample below) or b) if
12
+
the code is in the render function of a React.js component, move that code
0 commit comments