gtm-support / vue-gtm

Simple implementation of Google Tag Manager for Vue
https://www.npmjs.com/package/@gtm-support/vue-gtm
MIT License
192 stars 23 forks source link

Bug: Cannot find module '@gtm-support/vue-gtm' or its corresponding type declarations #421

Closed slauzinho closed 1 month ago

slauzinho commented 1 month ago

Info

Tool Version
Plugin v3.0.0
Vue v3.4.27
Node v18.18.2
OS mac

Output or Error

Cannot find module '@gtm-support/vue-gtm' or its corresponding type declarations.

Expected Output

No ts errors

Additional Context

vitaliitrush commented 1 month ago

+1

Shinigami92 commented 1 month ago

Please test out v3.0.1 and if it does not work then reopen this issue

vitaliitrush commented 1 month ago

CleanShot 2024-06-03 at 18 43 03@2x

Please make 'vue-router' as an external dependency

Shinigami92 commented 1 month ago

CleanShot 2024-06-03 at 18 43 03@2x

Please make 'vue-router' as an external dependency

Is this an issue with tsup? https://tsup.egoist.dev/#excluding-packages

Maybe also open a separate issue for that Also please try to create a PR for that. Checkout the repo and run the build command, then see that this is only in .d.ts file I'm not sure how to fix this right now

slauzinho commented 1 month ago

@Shinigami92 Version 3.0.1 fixes the issue, thank you 👍

vitaliitrush commented 1 month ago

@slauzinho how did you handle VueRouter error?

slauzinho commented 1 month ago

I don't have that error, maybe because I'm using vue-router?

vitaliitrush commented 1 month ago

I'm using vue-router too))

vitaliitrush commented 1 month ago

CleanShot 2024-06-03 at 19 11 17

vitaliitrush commented 1 month ago

@Shinigami92 external did not help :(

slauzinho commented 1 month ago

I get not warnings / errors doing this:

app.use(
  createGtm({
    id: 'XXXXXX',
    queryParams: {
      gtm_auth: import.meta.env.VITE_GTM_AUTH,
      gtm_preview: import.meta.env.VITE_GTM_PREVIEW,
      gtm_cookies_win: 'x',
    },
    enabled: !import.meta.env.DEV,
    loadScript: !import.meta.env.DEV,
    vueRouter: router,
  })
);

Using:

"vue-router": "^4.3.2",
"vue": "^3.4.27",
"@gtm-support/vue-gtm": "^3.0.1",
"typescript": "^5.4.5",
vitaliitrush commented 3 weeks ago

fixed lol CleanShot 2024-06-14 at 15 09 24