Vue.js Vuepress与Okta身份验证-生成期间未定义窗口

Vue.js Vuepress与Okta身份验证-生成期间未定义窗口,vue.js,oauth,production,okta,vuepress,Vue.js,Oauth,Production,Okta,Vuepress,我一直在学习为我的vuepress站点添加身份验证的教程。在dev模式下运行时,这一切都非常有效,但当我尝试构建应用程序时,会收到以下错误: wait Rendering static HTML... Rendering page: /error Error rendering /: false undefined ReferenceError: window is not defined at Object.module.exports.Op (node_modules/@okta/okta

我一直在学习为我的vuepress站点添加身份验证的教程。在dev模式下运行时,这一切都非常有效,但当我尝试构建应用程序时,会收到以下错误:

wait Rendering static HTML...
Rendering page: /error Error rendering /: false
undefined
ReferenceError: window is not defined
 at Object.module.exports.Op (node_modules/@okta/okta-vue/dist/okta- 
vue.js:1:222)
at __webpack_require__ (webpack/bootstrap:25:0)
at Module.<anonymous> (server-bundle.js:4649:16)

目前为此提出的问题:
import Auth from "@okta/okta-vue";
import { oktaConfig } from "./oktaConfig";

export default ({ Vue, options, router, siteData }) => {
  Vue.use(Auth, oktaConfig);
  router.beforeEach(async (to, from, next) => {
    const auth = await Vue.prototype.$auth.isAuthenticated();
    if (!auth && to.path !== "/implicit/callback/") {
      Vue.prototype.$auth.loginRedirect(to.path);
    } else {
      next();
    }
  });
};