Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
davidwitten opened this issue Dec 25, 2020 · 1 comment

Comments

@davidwitten
Copy link

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

@willb335
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants