Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt 3 Support #18

Open
eMeRiKa13 opened this issue Jan 10, 2022 · 15 comments
Open

Nuxt 3 Support #18

eMeRiKa13 opened this issue Jan 10, 2022 · 15 comments

Comments

@eMeRiKa13
Copy link

Hi,

Is this plugin compatible with Nuxt 3?

Thank you

@toniengelhardt
Copy link

Doesn't seem to work atm, it doesn't send any data...

@moritzsternemann
Copy link
Owner

Thanks for filing the issue! Nuxt 3 as well as Vue 3 support is a priority but unfortunately I won't have time to work on this until mid February. I'll update you as soon as I know more.

@toniengelhardt
Copy link

toniengelhardt commented Jan 23, 2022

Update:

It actually seems to work. Forgot to set the domain in settings...

You just have to add the module and set the domain in "plausible" settings:

// nuxt.config.ts

modules: [
  'vue-plausible',
],

plausible: {
  domain: 'my-domain.com',
},

Disclaimer:

Haven't tested if all events are fired correctly, but at first glance it looks good.

Update:

The module creates problems with <a> tags, see comment below.

@Atinux
Copy link

Atinux commented Feb 16, 2022

I can confirm it works with Nuxt 3 😊

@IzakJackson
Copy link

Having an issue on Nuxt 3 where my modals open then refresh the page as soon as I install this module. When I remove the module everything works as normal.

@toniengelhardt
Copy link

@IzakJackson you are right, I have a similar problem with <a> tags. Until I saw your comment I didn't realize it was caused by the Plausible module. As soon as I enable the module <a> tags behave weird, target="_blank" doesn't work, all links always open in the current tab and when using an <a> tag without href, e.g. as a button, clicking on it will refresh the page.

@IzakJackson
Copy link

@toniengelhardt Yeah, it was on an <a> tag that I was having this issue actually.

@toniengelhardt
Copy link

@IzakJackson as a temporary workaround you can use <div>s instead of anchors.

@bmhtech07
Copy link

@IzakJackson you are right, I have a similar problem with <a> tags. Until I saw your comment I didn't realize it was caused by the Plausible module. As soon as I enable the module <a> tags behave weird, target="_blank" doesn't work, all links always open in the current tab and when using an <a> tag without href, e.g. as a button, clicking on it will refresh the page.

I've encountered the same problem, but found that disabling enableOutboundTracking fixed the target="_blank" problem. Not a great solution though...

@toniengelhardt
Copy link

Thanks @bmhtech07, you're right, disabling outbound tracking resolves the problem!

@productdevbook
Copy link

 ERROR  [vite]: Rollup failed to resolve import "plausible-tracker" from "virtual:nuxt:/home/productdevbook/Documents/GitHub/vucod/bb/.nuxt/vue-plausible.client.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

@blackspike
Copy link

omg I was wondering why my "_blank" links weren't working! same issue here, disabling enableOutboundTracking fixes it but would love to have both blank & outbound tracking!

@ricky11
Copy link

ricky11 commented Oct 3, 2022

module does work with with nuxt3 rc 11, BUT console shows errors (below), anything we can do to silence these ?

warn] [nuxt] You are using a plugin with legacy Nuxt 2 format (context, inject) which is likely to be broken. In the future they will be ignored: PlausiblePlugin

@productdevbook
Copy link

productdevbook commented Oct 3, 2022

Nuxt 3 library

our own library

@dissy123
Copy link

Plugin not working with Nuxt3 Stable 3.0.0

Cannot read properties of undefined (reading 'options') 23:39:55

at PlausibleModule (node_modules/vue-plausible/lib/cjs/nuxt-module.js:18:89)
at installModule (node_modules/@nuxt/kit/dist/index.mjs:416:9)
at async initNuxt (node_modules/nuxt/dist/index.mjs:1825:7)
at async loadNuxt (node_modules/nuxt/dist/index.mjs:1857:5)
at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:493:19)
at async Object.invoke (node_modules/nuxi/dist/chunks/build.mjs:34:18)
at async _main (node_modules/nuxi/dist/cli.mjs:50:20)

Options were set in nuxt.config.ts
It Stopped working after upgrading from RC11 to 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants