question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Requiring vue-quill-editor/dist/ssr: document is not defined

See original GitHub issue

On vue-quill-editor 3.0.3, require vue-quill-editor/dist/ssr when rendering on server side results in

ReferenceError: document is not defined
    at Object.DIFF_DELETE ([...]/foo/node_modules/quill/dist/quill.js:7450:21)
    at __webpack_require__ ([...]/foo/node_modules/quill/dist/quill.js:36:30)
    at Object.defineProperty.value ([...]/foo/node_modules/quill/dist/quill.js:975:1)
    at __webpack_require__ ([...]/foo/node_modules/quill/dist/quill.js:36:30)
    at Object.defineProperty.value ([...]/foo/node_modules/quill/dist/quill.js:4988:14)
    at __webpack_require__ ([...]/foo/node_modules/quill/dist/quill.js:36:30)
    at Object.defineProperty.value ([...]/foo/node_modules/quill/dist/quill.js:9832:13)
    at __webpack_require__ ([...]/foo/node_modules/quill/dist/quill.js:36:30)
    at Object.<anonymous> ([...]/foo/node_modules/quill/dist/quill.js:11344:18)
    at __webpack_require__ ([...]/foo/node_modules/quill/dist/quill.js:36:30)
let VueQuillEditor

if(!Vue.prototype.$isServer) {
    VueQuillEditor = require('vue-quill-editor')
} else {
    VueQuillEditor = require('vue-quill-editor/dist/ssr')
}

Vue.use(VueQuillEditor)

Could you enlighten me if I’m missing something?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
outOFFspacecommented, Dec 19, 2017

That’s because of var _quill = require('quill'); It uses document

0reactions
surmon-chinacommented, Dec 5, 2017

I do not think you understand how webpack and ssr work together, so it’s hard to explain; all you need to know is that everything you have to do with SSR when using SSR rendering output.

In a program involving SSR rendering, you can not use components, you can only use vue-quill-editor/dist/ssr

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: document is not defined (in plain JavaScript)
When you are using server side rendering there is no browser. Hence, there will not be any variable window or document . Hence...
Read more >
How to fix ReferenceError: Document is not defined ... - Sabe.io
The best way to resolve this is to just move your code to the bottom of the page so that the document will...
Read more >
How to solve the document is not defined error - Flavio Copes
Here's how to fix the “referenceerror: document is not defined” error that you might have in Node.js or with a tool like Next.js....
Read more >
Fix ReferenceError: document is not defined in JavaScript
This article covers the reasons why "ReferenceError: document is not defined" may arise and solutions to implement which can resolve them.
Read more >
ReferenceError: document is not defined in JavaScript
js server-side application, and does not have access to the document object that is defined by the browser. For example, if you try...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found