Write a description document for the component library, but an error is reported when packaging and deployment: the document is not defined. You can only find out the reason after checking the data, because vuepress is rendered through the node.js server when packaging, and an error is reported because there is no document object in node.js. The final solution is as follows:. Vuepress/enhanceapp.js folder
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
//The way it was introduced before - will cause an error to be reported
// import CommonUI from 'vue-common-ui'
import 'vue-common-ui/lib/vue-common-ui.css'
export default async ({ Vue }) => {
if (typeof process === 'undefined') {
Vue.use(ElementUI)
// Solve the problem of introducing your own components with the error document not found
Vue.mixin({
mounted() {
import('vue-common-ui').then(function(m) {
Vue.use(m.default)
})
}
})
}
}
After modifying the introduction method of Vue common UI components, the online address of the component library is normally packaged
Read More:
- Vuepress build error: window is not defined [How to Solve]
- [Solved] Nuxt Import qrcodejs2.js / QRCode.js Error: document is not defined
- [Solved] vite package Error: globalThis is not defined
- How to Solve “Vue is not defined” Error
- Ant design vue table Error: h is not defined [How to Solve]
- [Solved] JQuery each Method Error: $XXX is not defined
- [Solved] Vue item error: Regeneratorruntime is not defined
- [Solved] vite2+vue3 jsx Error: React is not defined
- vue eslint error ‘process‘ is not defined no-undef [How to Solve]
- [Solved] Uncaught ReferenceError: axios is not defined
- [Solved] Vue 3 Script Setup ESLint Error: ‘defineProps‘ is not defined
- [Solved] Vue uses webpack to package error: Createapp is not a function
- Javascript SecurityError: Failed to read the’localStorage’ property from’Window’: Access is denied for this document.
- [Solved] Vue3 process Error: Uncaught ReferenceError: process is not defined
- [Solved] webpack Package Error: TypeError: this.getOptions is not a function style-loader
- [Go] Can structure/structure pointer be compared with operator == is not defined error
- vue.config.js build Package UglifyJsPlugin to clear console and print console.log Error: `warnings` is not a supported option
- vue error: ‘ev’ is defined but never used (no-unused-vars)
- [Solved] Vue Error: template or render function not defined
- [Solved] Vue Error: error: ‘to‘ is defined but never used (no-unused-vars)