react-responsive-image icon indicating copy to clipboard operation
react-responsive-image copied to clipboard

Error on server side rendering

Open bezugen opened this issue 6 years ago • 2 comments

I'm using razzle to server side render my react app and it shows this error:

ReferenceError: window is not defined at Object../node_modules/react-responsive-image/assets/js/lib/react-responsive-image.build.js

bezugen avatar Feb 27 '19 09:02 bezugen

@bezugen In many cases it can be fixed using a polyfill in node. import '@babel/polyfill';

micros123 avatar Mar 05 '19 10:03 micros123

HI, @bezugen did @micros123 fix help you? I have been having this issue on Netlify and have fixed the issue in my fork by adding checks for the window object in the ResponsiveImage.jsx file in assets/js/src/components/ResponsiveImage.jsx and rebuilding the minified js.

luxumbra avatar Feb 17 '20 17:02 luxumbra