Vue.js - Component is missing template or render function
When app.component(...)
is provided a definition object (the 2nd argument), it returns the application instance (in order to allow chaining calls). To get the component definition, omit the definition object and provide only the name:
app.component('home', { /* definition */ })const Home = app.component('home')const router = createRouter({ routes: [ { path: '/', component: Home }, //... ]})
FOR vue-cli vue 3
render function missed in createApp.When setting your app by using createApp function you have to include the render function that include App.
in main.jsupdate to :
FIRSTchange the second line in javascript from:-
const { createApp } = Vue
to the following lines:
import { createApp,h } from 'vue'import App from './App.vue'
SECOND
Change from :-
const app = createApp({})
to:
const app = createApp({ render: ()=>h(App)});app.mount("#app")
The solution was simple on my side, I created a component that was empty, after filling in the template and a simple text HTML code, it was fixed.