Skip to content

Commit

Permalink
feat: makes imports more nuxt2 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
tikagan committed Jan 25, 2024
1 parent dada952 commit a04227d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/nuxt-module-plausible/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ console.log('📦 [load:module] nuxt-module-plausible')
// -----------------------------------------------------------------------------
import Path from 'path'

import { defineNuxtModule, addPlugin } from 'nuxt/kit'
import { defineNuxtModule, addPlugin } from '@nuxt/kit'

// ////////////////////////////////////////////////////////////////////// Config
// -----------------------------------------------------------------------------
Expand Down
9 changes: 4 additions & 5 deletions modules/nuxt-module-plausible/plugin.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
// ///////////////////////////////////////////////////////////////////// Imports
// -----------------------------------------------------------------------------
import { defineNuxtPlugin, useRuntimeConfig, useRouter } from '#imports'
// import Config from '@/nuxt.config'
import { defineNuxtPlugin } from '#imports'

// ////////////////////////////////////////////////////////////////////// Export
// -----------------------------------------------------------------------------
export default defineNuxtPlugin(() => {
export default defineNuxtPlugin((nuxtApp) => {

// Do not fire Plausible if not in production mode
if (process.env.NODE_ENV !== 'production') {
return
}

const router = useRouter()
const config = useRuntimeConfig()
const router = nuxtApp.$router
const config = nuxtApp.$config.public.siteUrl
let isInitialPageLoad = true

router.afterEach((to) => {
Expand Down

0 comments on commit a04227d

Please sign in to comment.