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

ReferenceError: document is not defined #19

Closed
Katarzina opened this issue Jun 28, 2017 · 5 comments
Closed

ReferenceError: document is not defined #19

Katarzina opened this issue Jun 28, 2017 · 5 comments

Comments

@Katarzina
Copy link

Katarzina commented Jun 28, 2017

vue & vue-cookie-law version

2.0.x, x.y.z

Reproduction Link

Steps to reproduce

What is Expected?

What is actually happening?

nuxt

<template>
<footer>
<div class="wrapper dark-gray no-padding">`

 
 
 <cookie-law theme="dark-lime"></cookie-law>
    </div>
</footer>

</template>

<script>
import CookieLaw from 'vue-cookie-law';

export default {
  components: {
    CookieLaw
  }
}

</script>

I'v got:
Nuxt.js Error:

ReferenceError: document is not defined
at addStyle (/var/www/vue/node_modules/vue-cookie-law/dist/vue-cookie-law.js:579:22)

@apertureless
Copy link
Owner

apertureless commented Jul 10, 2017

Hey @Katarzina

Mh yeah I guess this is a common thing for plugins that are working only in the browser. There are some guides in the nuxt.js docs on how to disable ssr for certain plugins.

I guess that the localStorage stuff is making some trouble here.

@Katarzina
Copy link
Author

thank you...your advice has helped

@indifisher
Copy link

I've just run into this exact issue. @Katarzina please, can you let me know how you resolved this?

@indifisher
Copy link

Fixed in nuxt by wrapping in <no-ssr></no-ssr>!

valeriosillari added a commit to valeriosillari/zitronenstrasse that referenced this issue May 24, 2018
@anvlkv
Copy link

anvlkv commented Oct 9, 2019

Or event better with vue-client-only <client-only></client-only>

Sorry got instantly fed up with nuxt's too much magic(TM)

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

4 participants