Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to mount component: template or render function not defined. #32

Closed
VictorOnwukwe opened this issue Jan 9, 2020 · 6 comments
Closed

Comments

@VictorOnwukwe
Copy link

It keeps giving the error "Failed to mount component: template or render function not defined."

And I have all dependencies required to load the component.

@tyrrminal
Copy link

I got that error when I imported and added this component directly to my view component. However, it worked properly when I instead added it globally to my app's main.js. It should work both ways, but this workaround may help you.

@wanderleypanosso
Copy link

wanderleypanosso commented Jan 15, 2020

@objcow I'm facing the same issue here and it is not working even with global registration.

import imageUploader from 'vue-image-upload-resize'

Vue.component('image-uploader', imageUploader)

Is this how you did it?

@tyrrminal
Copy link

I did:

import ImageUploader from "vue-image-upload-resize";
Vue.use(ImageUploader);

@vsirghii
Copy link

I'm also having the same message "Failed to mount component: template or render function not defined." when imported and added this component directly to my view component. Yes global installation works (with Vue.use(ImageUploader);) but that creates a global instance and in my scenario, when I have couple of vue components with ImageUploader on the same page, images are uploaded into first instance only.
Is there any way to register ImageUploader on a vue component, not on the whole app, as usual registration:

<script> import ImageUploader from "vue-image-upload-resize"; export default { name: 'TagImage', components: { ImageUploader }....

@svale
Copy link
Member

svale commented Jan 27, 2020

Hi @vsirghii (cc @objcow, @wanderleypanosso, @VictorOnwukwe)

Sorry about this. I somehow messed up how Vue CLI builds for library as target. The new 2.3 release should help.

With this version it is possible to use both initalising as a global plugin (using Vue.use()) and local registration inside another component:

export default {
  components: { 
    ImageUploader
  },
  // ...
}  

@vsirghii
Copy link

vsirghii commented Jan 27, 2020

Awesome Svale .That's a great news. You guys are doing really good job here.

@svale svale closed this as completed Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants