chessboardjsx icon indicating copy to clipboard operation
chessboardjsx copied to clipboard

WebpackError: ReferenceError: window is not defined when using ChessboardJSX with Gatsby

Open davidwitten opened this issue 4 years ago • 1 comments

I have a React component, and I want to include a Chessboard component within it.

So, I only added this line to my file. import Chessboard from 'chessboardjsx'; I never actually used the Chessboard in my code, but it still returned this error:

  WebpackError: ReferenceError: window is not defined
  
  - chessboard.min.js:1 
    node_modules/chessboardjsx/dist/chessboard.min.js:1:253

When I remove that line, my code works as expected.

I'm using React v17.0 and Gatsby 2.27.5

davidwitten avatar Dec 25 '20 04:12 davidwitten

Take a look at this, it may be helpful: https://medium.com/@raravi/gatsby-and-the-window-variable-352ed558a8c0

willb335 avatar Dec 25 '20 20:12 willb335