fix vue failed to mount component: template or render function not defined.

If you are getting failed to mount component: template or render function not defined error. This article will help you to fix the issue. The…

The post fix vue failed to mount component: template or render function not defined. appeared first on CodeSource.io.


This content originally appeared on CodeSource.io and was authored by Deven

If you are getting failed to mount component: template or render function not defined error. This article will help you to fix the issue.

The most common Solution is that It should be

require('./components/Example.vue').default. 

Since v13, vue-loader exports the component as the default key, which still works the same when using import, but requires the above when using require.

Consider the example below:

let routes = [{
    path: '/contact',
    component: require('./components/Contact.vue').default
  },
  {
    path: '/about',
    component: require('./components/About.vue').default
  }
]

Above we haver added .default to our component requires.

The post fix vue failed to mount component: template or render function not defined. appeared first on CodeSource.io.


This content originally appeared on CodeSource.io and was authored by Deven


Print Share Comment Cite Upload Translate Updates
APA

Deven | Sciencx (2021-02-23T17:21:36+00:00) fix vue failed to mount component: template or render function not defined.. Retrieved from https://www.scien.cx/2021/02/23/fix-vue-failed-to-mount-component-template-or-render-function-not-defined/

MLA
" » fix vue failed to mount component: template or render function not defined.." Deven | Sciencx - Tuesday February 23, 2021, https://www.scien.cx/2021/02/23/fix-vue-failed-to-mount-component-template-or-render-function-not-defined/
HARVARD
Deven | Sciencx Tuesday February 23, 2021 » fix vue failed to mount component: template or render function not defined.., viewed ,<https://www.scien.cx/2021/02/23/fix-vue-failed-to-mount-component-template-or-render-function-not-defined/>
VANCOUVER
Deven | Sciencx - » fix vue failed to mount component: template or render function not defined.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/02/23/fix-vue-failed-to-mount-component-template-or-render-function-not-defined/
CHICAGO
" » fix vue failed to mount component: template or render function not defined.." Deven | Sciencx - Accessed . https://www.scien.cx/2021/02/23/fix-vue-failed-to-mount-component-template-or-render-function-not-defined/
IEEE
" » fix vue failed to mount component: template or render function not defined.." Deven | Sciencx [Online]. Available: https://www.scien.cx/2021/02/23/fix-vue-failed-to-mount-component-template-or-render-function-not-defined/. [Accessed: ]
rf:citation
» fix vue failed to mount component: template or render function not defined. | Deven | Sciencx | https://www.scien.cx/2021/02/23/fix-vue-failed-to-mount-component-template-or-render-function-not-defined/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.