-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
"window is not defined" error with React / Next.js #2015
Comments
Same issue. I am stuck with this for days now. Tho I am aware of html2canvas cann't be used with nodejs. |
@cwbuecheler, |
@subhendukundu - thanks. That kind of helps, though unfortunately the error is occurring on the import, not on any usage (even if I put the usage in |
Should be fixed with #2039 |
what version is this included? |
Which release fixes the issue? |
This issue is still happening in Node application... |
does this fix exist in 1.0.0-rc.5 ? I'm still having this issue. |
only that it's
|
still happening with node 12 |
this solution works for me on latest nextjs and html2canvas |
Please follow the general troubleshooting steps first:
Bug reports:
I'm attempting to use HTML2Canvas in a React app that's built atop Next.js. It seems to be having trouble with the global
window
variable, which is odd since I'm only importing it in the client side of the app. Here's the code:Here's the error:
And here's the offending line in
/dist/html2canvas.js
:I'm absolutely open to the idea that I'm doing something incorrectly or that "this just doesn't work with Next.js" but I'm hoping there's an obvious solution someone knows of!
Specifications:
The text was updated successfully, but these errors were encountered: