score:1

Accepted answer

i got the same issue today about "library only available for browser", namely the one using window (react-chartjs-2 in my case).

after digging a little bit you can use the following npm package to fix it: https://www.npmjs.com/package/window-or-global

if you don't want to use external package, you can also check if windows is defined in your server.js and create a global window variable if not:

if (typeof(window) == 'undefined') global.window = new object();

Related Query

More Query from same tag