Last active
November 24, 2020 14:26
-
-
Save 8ctopotamus/0c84596dc8090ded205c1196e5f7160f to your computer and use it in GitHub Desktop.
gatbys build DOM protection: Avoid Gatsby Build Errors when working with DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we need to guard against anything that uses document or window | |
// for the gatsby build to work because there is no DOM in the build process. | |
// Example of importing a package such as sketch-js: | |
let sketch | |
if (typeof document !== 'undefined') | |
sketch = require('sketch-js') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment