-
DescriptionI'm trying to use recoil and recoil-persists with gatsby and everything works while running it with Steps to reproduceI've made a sandbox with the code: https://codesandbox.io/s/idx7q It is a simple starter which has some
Expected resultJust as Actual result
Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
As the error message says:
You'll need to handle window/browser elements during SSR as they are not available in Node: |
Beta Was this translation helpful? Give feedback.
-
In your ternary you're using node-localstorage in the browser, but not in node. You probably want it the other way around. The node-localstorage docs have a good example of how to use it as a polyfill. |
Beta Was this translation helpful? Give feedback.
As the error message says:
You'll need to handle window/browser elements during SSR as they are not available in Node:
https://www.gatsbyjs.com/docs/debugging-html-builds/