Skip to content
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

document is not defined error when building with webpack #185

Closed
nitinagrawal08 opened this issue Apr 12, 2017 · 3 comments
Closed

document is not defined error when building with webpack #185

nitinagrawal08 opened this issue Apr 12, 2017 · 3 comments

Comments

@nitinagrawal08
Copy link

After npm install react-quill, using the same in my component with import ReactQuill from 'react-quill'. However on npm start webpack failed with below error:

`var elem = document.createElement('div');
^

ReferenceError: document is not defined
at Object.defineProperty.value (/Users/nitinagrawal/iref-webapp/node_modules/quill/dist/quill.js:6135:12)
at webpack_require (/Users/nitinagrawal/iref-webapp/node_modules/quill/dist/quill.js:36:30)
at Object.defineProperty.value (/Users/nitinagrawal/iref-webapp/node_modules/quill/dist/quill.js:1044:1)`

React-quill version "react-quill": "^1.0.0-rc-1"

@nitinagrawal08 nitinagrawal08 changed the title document is not defined error at quill/dist/quill.js:6135:12 when building with webpack document is not defined error when building with webpack Apr 12, 2017
@alexkrolick
Copy link
Collaborator

Are you rendering server side? See #122

@nitinagrawal08
Copy link
Author

nitinagrawal08 commented Apr 13, 2017

Our pages are SEO friendly so have to load them on server side only.

@alexkrolick
Copy link
Collaborator

alexkrolick commented Apr 13, 2017

The Quill library relies heavily on DOM APIs. At this time we don't provide a workaround if a DOM is not available. In #122 there is a discussion about different ways to handle this. Basically it comes down to rendering a textarea if document is not defined at render time. Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants