alec_lloyd_probert
alec_lloyd_probert

Reputation: 176

Error on importing VueAnalytics to main.ts in Vue CLI (Vue3)

The following error message is given:

"Argument of type 'typeof VueAnalytics' is not assignable to parameter of type 'Plugin_2'. Type 'typeof VueAnalytics' is not assignable to type '{ install: PluginInstallFunction; }'. Types of property 'install' are incompatible."

What am I doing wrong ? Thank you very much for your help.

import { createApp } from "vue";
import App from "./App.vue";
import "./registerServiceWorker";
import router from "./router";
import store from "./store";
import VueAnalytics from "vue-analytics";

createApp(App)
  .use(store)
  .use(VueAnalytics, {id:'', router})
  .mount("#app");

Upvotes: 2

Views: 2692

Answers (1)

Dan
Dan

Reputation: 63059

This error indicates that the plugin was built for Vue 2 and is not compatible with Vue 3. Checking the package's npm page reveals that there have been no updates in the last year. The requirement also lists Vue 2.

The last Github commit was in January.

Following some links from the package's Github leads to this package which looks like it may work with Vue 3.

Upvotes: 2

Related Questions