Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mcl_wtn's avatar

How to install a Vue Plugin? (vue-async)

I'm using Vue in a Spark app and am trying to integrate the vue-async plugin. Unfortunately to no success.

I've tried to integrate it following the install instructions and my app.js looks like this:

require('spark-bootstrap');
require('./components/bootstrap');

//Load the async data library for global use
var VueAsyncData = require('vue-async-data');
Vue.use(VueAsyncData);

//Register my-overview as a global component
import MyOverview from './components/my-overview.vue';
Vue.component('my-overview', MyOverview); //uses VueAsyncData

var app = new Vue({
    mixins: [require('spark')]
});

When hitting the page that uses my-overview I am given the following error in the console: app.js:24945[Vue warn]: Unknown custom element: <my-overview> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

Uncommenting Vue.use(VueAsyncData); enables Vue to find my component again and loads it albeit without vue-async being installed.

So my questions are:

  1. Are there any obvious errors with the way I tried to integrate the plugin in the app.js?
  2. Are there any standard ways in which to load Vue plugins into Laravel ( or Spark) apps? * I did have a look at how it's being done with vue-resource but it seems it is calling Vue.use() in it's source and that's what's being relied on attach it to the Vue instance.
0 likes
2 replies
bedakb's avatar

I just see the my-overview component registered.

Also I think you don't need to use Vue.component register if you already imported i.

mcl_wtn's avatar

Hi bedakb, thanks for taking the time to help :)

When you say you see the my-overview component registered are you also able to use the plugin?

Please or to participate in this conversation.