question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template or render function not defined.

See original GitHub issue

After e few hours of pulling my hair and furious googling, I can’t come up with an other solution then to open this issue.

I tried to include multiselect (2.0 branch) into my vue 2.0 project. Unfortunately, the components doesn’t want to work, giving me the following error:

[Vue warn]: Failed to mount component: template or render function not defined. (found in component <Multiselect>)

I know that this has something to do with the standalone built vs realtime only buit. But even when I include Vue using import Vue from 'vue/dist/vue.js' (or the suggested alias way), it still gives me this issue. I also checked your package, and it seems you don’t even use render options afaik.

I’m using the component in a Vue/Laravel/Elixir setup which uses webpack.

I add your component using the following line (just like all my other components):

Vue.component('Multiselect', require('vue-multiselect'));

Unfortunately, all of your examples give me the same issue.

Any idea where to look for a solution?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
MichMichcommented, Nov 22, 2016

This solved the issue:

Vue.component('Multiselect', require('vue-multiselect').default)

Thanks a lot! 😃

3reactions
shentaocommented, Nov 22, 2016

Crap. Really sorry to hear that. 😔

Not sure why the default import doesn’t work out of the box when using require(). I will look into it later. Thanks for bringing this up.

Anyway, there are several workarounds for this:

Either use es6 modules:

import VueMultiselect from 'vue-multiselect'
Vue.component('Multiselect, VueMultiselect)

Or do it this way.

Vue.component('Multiselect', require('vue-multiselect').default)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue template or render function not defined yet I am using ...
In my case, I was getting the error because I upgraded from Laravel Mix Version 2 to 5. In Laravel Mix Version 2,...
Read more >
Failed to mount component: template or render function not ...
A render function takes an argument which itself is a function. This function creates you a vnode. The render function expects you to...
Read more >
Laravel + Vue.js - template or render function not defined.
Hi, I am trying to use vue-router links to load my home and about.vue but I get this error: app.js:64725 [Vue warn]: Failed...
Read more >
template or render function not defined when mounting a ...
The component is not displaying and in the console there is an error: Failed to mount component: template or render function not defined....
Read more >
Fix vue failed to mount component: template or render function ...
If you are getting failed to mount component: template or render function not defined error. This article will help you to fix the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found