vuepress & ReferenceError: window is not defined
vuepress & ReferenceError: window is not defined
bug
✔ Client
Compiled successfully in 15.35s
✔ Server
Compiled successfully in 8.27s
wait Rendering static HTML...
error Error rendering /guide/: false
undefined
error Error rendering /config/: false
undefined
error Error rendering /: false
undefined
error Error rendering /guide/multi-select.html: false
undefined
error Error rendering /404.html: false
undefined
ReferenceError: window is not defined
solution 🚀✅
Async/Await & dynamic import module
// import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '../../lib/gui.css';
export default async ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData, // site metadata,
isServer
}) => {
// 使用 element-ui
Vue.use(ElementUI);
// 使用 gui
if (!isServer) {
await import('../../lib/gui.common.js').then(module => {
Vue.use(module.default);
});
}
}
refs
https://www.cnblogs.com/xgqfrms/p/14421995.html
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14362785.html
未经授权禁止转载,违者必究!