TylerBarnes / gatsby-plugin-transition-link

A link component for page transitions in gatsby
537 stars 71 forks source link

Problem with Gatsby build #243

Closed koniecznytomek closed 3 years ago

koniecznytomek commented 3 years ago

Hi, i have installed fresh Gatsby (2.24.79) and gatsby-plugin-transition-link 1.20.4. When i try to build i have this error:

failed Building static HTML for pages - 2.257s

 ERROR #95312 

"window" is not available during server side rendering.

See our docs page for more info on this error: https://gatsby.dev/debug-html

   5 | 
   6 | module.exports = ({ element }) => {
>  7 |  window.addEventListener('popstate', function(event) {
     |  ^
   8 |          // prevent the back button during transitions as it breaks pages
   9 |          if (window.__tl_inTransition) {
  10 |                  window.__tl_back_button_pressed = true

  WebpackError: ReferenceError: window is not defined

  - wrap-root.js:7 
    src/wrap-root.js:7:2

i don't have any additional libraries, only fresh Gatsby. any ideas?

thulasi-ram commented 3 years ago

Yep seems like 1.20.4 introduced the issue. 1.20.2 works fine. For now you can try installing 1.20.2

TylerBarnes commented 3 years ago

This is fixed in gatsby-plugin-transition-link@1.20.5, sorry about that!

koniecznytomek commented 3 years ago

Works! thanks! :)