Skip to content
Advertisement

Window is undefined error, when loading node_module package in a component

I am trying to use pickr package ( a color picker library) in my nuxt.js app , at import time it is providing error called window is undefined

here is code:

JavaScript

tried approaches

  • i made pickr package as a nuxt plugin added it to nuxt.config.js with mode:client
  • i made pickr package as a nuxt plugin added it to nuxt.config.js with ssr:false

but it did not work 😥

Advertisement

Answer

After struggles i came up with this approach and did work for me

JavaScript
Advertisement