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.

Version 1.13.0 broke SSR

See original GitHub issue

nuxt 2.12.2 vue 2.6.11 vue-cookie-law 1.13.2

Prior to version 1.13.0 I was using this plugin with Nuxt, and it was working perfectly. Nuxt render pages server-side, so I had to put the <vue-cookie-law> component in a <client-only> tag, like this:

<client-only>
  <cookie-law
    button-class="btn btn-primary"
  ></cookie-law>
</client-only>

With this new version, it is not working anymore, as I’m getting this error:

ReferenceError window is not defined node_modules/vue-cookie-law/dist/vue-cookie-law.js@15:4

Here a repro link with the version 1.13.2 installed: https://codesandbox.io/s/old-water-s4p24

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:11
  • Comments:20 (5 by maintainers)

github_iconTop GitHub Comments

21reactions
tre-devcommented, Jun 14, 2020

This works for me:

// plugins/cookie-law.ts
import Vue from 'vue'
import CookieLaw from 'vue-cookie-law'

export default () => {
  Vue.component('cookie-law', CookieLaw)
}
// nuxt.config.ts
plugins: [
    ...
    {src: '@/plugins/cookie-law', mode: 'client'}
  ]
// file.vue
<client-only>
   <cookie-law theme="base" />
</client-only>
6reactions
mikerogerzcommented, Apr 2, 2020

Further issues with 1.13.3 SSR build:

/node_modules/vue-cookie-law/dist/vue-cookie-law.js:972 var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]') ^ ReferenceError: document is not defined at addStyle

Read more comments on GitHub >

github_iconTop Results From Across the Web

Version 1.13.0 broke SSR - - Bountysource
Version 1.13.0 broke SSR. ... Prior to version 1.13.0 I was using this plugin with Nuxt, and it was working perfectly. Nuxt render...
Read more >
XPS 9570 - Bios Update 1.13.0 broke my Thunderbolt 3 - Dell
Solved: I have 2 WDTB16 docks that I use for my XPS 9570. One at my desk at work and one at home...
Read more >
Version 1.13: Messages Guide - IBM
The following sections provide zSecure 1.13.0 release information, including IBM ... Unexpected physical record length decnum in imbedded SSR with index ...
Read more >
Fix the upstream dependency conflict installing NPM packages
After upgrading to version 7.20.3, use command npm install -g ... as a version, because it might update major and break dependencies.
Read more >
broken-fast-mz4tt - CodeSandbox
broken -fast-mz4tt. 0. Embed Fork Create Sandbox Sign in. Sandbox Info. broken-fast-mz4tt. 0. 10. 1. kittenkitten ... preact-ssr-prepass. 1.1.1.
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