-
Notifications
You must be signed in to change notification settings - Fork 104
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 in 1.5.0 #78
Comments
@ahoys : error is not clear from above stack, can you plz add more details. |
Here's a snippet of the dist-code that is causing the crash:
This is how we use the package: Our app is isomorphic (SSR) which is probably related as the server doesn't have a window object. Here are our other draft-js related versions, although I'm not sure how could these interfere html-to-draftjs:
And I'd like to emphasize that no changes were made to our code before the crash. Our testing environments simply updated the package to 1.5.0 If I'd have to guess, some of the updated dependencies in the new version caused this. |
Downgrading to 1.4 is a temporary fix for those wondering |
SSR mode broken. |
This lib requires document object check. That is how it always worked, as I upgraded webpack its breaking the build. I am not sure how this worked with SSR previously. |
Having the same problem. |
I have a same issue. Any solutions for this issue so far? |
@locronaldo Solutions include:
|
If you are using Next.js you can import it like this: import dynamic from 'next/dynamic'
const htmlToDraft = dynamic(() => import('html-to-draftjs'), { ssr: false }) |
Hat tips to you sir! Update: not working for me in TS with next.js :( Removing node_modules and setting package.json to:
Was the only thing that worked for me |
you should also import normally not dynamic. |
Yup, but in this case it fails with the current react-draft-wysiwyg's version (1.14.7) which has html-to-draftjs version as a dependency. |
Since downgrading to 1.4.0 causes version incompatibilities I found this to be the only option working for me with Next.js and ts |
This is the only thing that worked for me. |
thank you very much...that worked for me 👍🏼 |
All of our testing environments broke down because of the recent changes.
This is the error that appears on launch:
The issue can be resolved by returning to version 1.4.0.
The text was updated successfully, but these errors were encountered: