P
P
ParaBellum5772021-01-06 20:50:34
React
ParaBellum577, 2021-01-06 20:50:34

"window" is not available during server side rendering?

Ask for help from those who know. the situation is as follows:
I'm trying to run a build in production, using gatsbyJS. But during the build process, a file is created

public\component---src-pages-app-js-72fe661da54bfe8b1c87.js

which tries to access the global window object. Which naturally leads to an error: error "window" is not available during server side rendering. In the code itself, I don't use window.
This is what the canvas looks like inside this file.
5ff5f8303e1cc021765968.png

Perhaps some kind of webpack setting is needed, I'm not strong in this. How many projects I did on Gatsby, no setup was required.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question