creotip / vue-particles

Vue.js component for particles backgrounds ✨

Home Page:http://vue-particles.netlify.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to fix Nuxt error with SSR (Cannot read property 'getElementsByClassName' of null)

MatteoGauthier opened this issue · comments

I searched for an answer but i can't find anything.
Here is my file
nuxt.config.js

plugins: [
    {
      src: "~/plugins/vue-particles",
      ssr: false
    }
  ]

it throws the error Cannot read property 'getElementsByClassName' of null on route change.

I fixed this by adding the mode to client

plugins: [
    {
      src: "~/plugins/vue-particles",
      mode: 'client'
    }
  ]

Problem solved, weird issue