Print.js
Print.js copied to clipboard
Error occurs while Next js building: ReferenceError: window is not defined.
Hi! Can we use print js in SSR projects?
yeap, I also encountered such problems.
Hi! Can we use print js in SSR projects?
you can avoid this by delaying the loading of print.js. load it during the runtime instead of build time
If you intend to use Print.js on the client side then you could import it dynamically when the user action is executed like this:
const printJS = (await import("print-js")).default
Take a look at Next.js docs for dynamic imports.
Does anyone solve this? Dynamic imports didn't work for me.
The problem is related to the loadIframeImage
method trying to load images created by next/image
. I'm using Next13.