Closed davellanedam closed 3 years ago
Errors when trying to use vue-gtag with Vue 3 + TS
vue-gtag@2.0.0
main.ts
import { createApp } from 'vue'; import App from './App.vue'; import './assets/styles/main.css'; const app = createApp(App, { getApp: () => app }); app.mount('#app');
App.vue
<template> <div> <router-view /> </div> </template> <script lang="ts"> import { App, defineComponent, PropType } from 'vue'; import { loadGoogleTags } from './services/googleTags'; export default defineComponent({ name: 'App', props: { getApp: { required: true, type: Function as PropType<() => App> } }, setup(props) { const app = props.getApp(); // Load other services... loadGoogleTags(app); } }); </script>
googleTags.ts
import { App } from 'vue'; import VueGtag from 'vue-gtag'; export function loadGoogleTags(app: App) { app.use(VueGtag, { config: { id: process.env.VUE_APP_GOOGLE_TAGS_CODE } }); }
:tada: This issue has been resolved in version 2.0.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Description
Errors when trying to use vue-gtag with Vue 3 + TS
Environment
vue-gtag@2.0.0
Reproducible Demo
main.ts
App.vue
googleTags.ts