Open realconvis opened 1 year ago
Now I've figured out how to reproduce the error explicitly. The error occurs whenever I run the "npx nuxi cleanup" command before the "npx nuxi dev". If I then stop and start the dev server without running the cleanup first, useGtm() is no longer undefined. Only when I run the cleanup again and start the dev server for the first time, useGtm() is undefined again. What could be the reason for this?
Having same issue. Appears to be an issue only in dev environment though.
I got the same issue.
I got the same issue. nuxt version: 3.2.3
Same here with Nuxt 3.9. Any way to resovle this?
It seems Vite does something unexpected when minifying code. (For me, it copied the useGtm function instead of importing it, but useGtm was relying on a locally scoped variable.) This PR upstream attempts to solve the problem: https://github.com/gtm-support/vue-gtm/pull/409
The GTM snippet is always loaded and the TrackView Event via router sync is always fired.
But I have the problem, that useGtm() inside vue components is randomly undefined.
If I stop and start the development server (npm run dev) several times or clear the cache (npx nuxi cleanup), it eventually works again. When I then restart the development server again later, it doesn't work again.
What could be the problem.