document is not defined in Nuxt
See original GitHub issueI use vue-qr-reader with<client-only> tag in Nuxt project, but I have an error: document is not defined and infinity loading page
To Reproduce
<template>
<client-only>
<QrcodeStream />
</client-only>
</template>
<script>
import { QrcodeStream } from 'vue-qrcode-reader'
...
Desktop
- OS: ubuntu 16.04
- Browser: chrome 79
- Version “vue-qrcode-reader”: “^2.1.1”
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
"document is not defined" in Nuxt.js - Stack Overflow
So Nuxt tried to renderer from server-side, but from Node.js window.document doesn't exist, then you have an error. nb: window.document is only ...
Read more >document is not defined with nuxt · Issue #764 - GitHub
I follow the instruction in readme and when I try to access my app I got the error: document is not defined.
Read more >[Solved]-"document is not defined" in Nuxt.js-Vue.js
It's a common error when you start a Nuxt project ;-). The Choices.js lib is available only for client-side! So Nuxt tried to...
Read more >Server Side Rendering - Nuxt
Server-side rendering (SSR), is the ability of an application to contribute by displaying the web-page on the server instead of rendering it in...
Read more >Javascript – “document is not defined” in Nuxt.js - iTecNote
The Choices.js lib is available only for client-side! So Nuxt tried to renderer from server-side, but from Node.js window.document doesn't exist, then you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I created plugin file for use VueQrcodeReader globally
Then added it in nuxt.config.js with mode: ‘client’
And just use it:
I think this should be added to the documentation.
Wrap the QrcodeStream in your own component and then import your component like this
components: { scanner: () => import('@/components/client-only/Scanner') }