Closed DanielJ06 closed 3 years ago
I would add a condition check if (window === undefined) { return null } else {return <Chessboard /> }
.
Chessboardjsx has a dependency on the window
object and when Next is building it does not have access to window
. I would also look into other chessboard libs as this one is unmaintained
Got it. It is a very cool lib, and it is sad that it is no longer maintained, do you have any recommendations for another similar lib?
Maybe check out this one: https://github.com/ruilisi/react-chessground
I'll take a look. Thank you very much for your attention
Hi @DanielJ06 if can help you, I've solved with these 3 lines of code and still using this wonderful library
import dynamic from 'next/dynamic';
const Chessboard = dynamic(() => import('chessboardjsx'), {
ssr: false // <- this do the magic ;)
});
Hi @DanielJ06 if can help you, I've solved with these 3 lines of code and still using this wonderful library
import dynamic from 'next/dynamic'; const Chessboard = dynamic(() => import('chessboardjsx'), { ssr: false // <- this do the magic ;) });
Thank you so much!
Hi @DanielJ06 if can help you, I've solved with these 3 lines of code and still using this wonderful library
import dynamic from 'next/dynamic'; const Chessboard = dynamic(() => import('chessboardjsx'), { ssr: false // <- this do the magic ;) });
thx so much bro .... you are god
I tried to use with next recently, and got the error "window not defined". Any idea how to solve?