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

Viewed 1774

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");

1 Answers

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.

Related