Skip to content

Commit

Permalink
fix: hotfix provide for nuxt 3 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jul 13, 2022
1 parent f7d6594 commit 1bbb6da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/nuxt-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ const PlausiblePlugin: Plugin = (context, inject) => {
plausible.enableAutoOutboundTracking()
}

inject('plausible', plausible)
if (inject) {
// Nuxt 2
inject('plausible', plausible)
} else {
// Nuxt 3
context.provide('plausible', plausible)
}
}

export default PlausiblePlugin

0 comments on commit 1bbb6da

Please sign in to comment.