2

It looks like Vuepress is made for public docs, but we decided to add client and server security to protect some of the doc pages. But unfortunately although oidc-client (https://github.com/IdentityModel/oidc-client-js/wiki) works during dev, it throws exception when build.

I get ReferenceError: window is not defined and when I try to trick the compiler with const window = window || { location: {} }; I get TypeError: Cannot read property 'getItem' of undefined

Any idea how to make this work?

Teddy
  • 304
  • 5
  • 17

1 Answers1

0

This was driving me nuts also. I discovered the component I was trying to add was looking at window.location in its code - this was triggering the error.

My understanding is that the build process has not access to Browser things like window etc.

As soon as I removed the window.location bit from my code things built just fine and all is well.

sitesbyjoe
  • 1,861
  • 15
  • 21