Skip to content

Commit

Permalink
feat(nuxt): bump @vue-final-modal/nuxt module to nuxt 3 latest
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterliu1003 committed Jan 17, 2023
1 parent 04c41c9 commit 21e592d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 4 additions & 11 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { resolve } from 'path'
import { fileURLToPath } from 'url'
import { addPlugin, defineNuxtModule } from '@nuxt/kit'
import { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit'

export interface ModuleOptions {
addPlugin: boolean
}

export default defineNuxtModule<ModuleOptions>({
export default defineNuxtModule({
meta: {
name: '@vue-final-modal/nuxt',
configKey: 'vue-final-modal',
},
setup(options, nuxt) {
const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))
nuxt.options.build.transpile.push(runtimeDir)
addPlugin(resolve(runtimeDir, 'plugin'))
const { resolve } = createResolver(import.meta.url)
addPlugin(resolve('./runtime/plugin'))

nuxt.options.css.push('vue-final-modal/style.css')
},
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/src/runtime/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createVfm } from 'vue-final-modal'
import { defineNuxtPlugin } from '#app'
import { defineNuxtPlugin } from 'nuxt/app'

export default defineNuxtPlugin((nuxtApp) => {
const vfm = createVfm() as any
const vfm = createVfm()

nuxtApp.vueApp.use(vfm)
})

0 comments on commit 21e592d

Please sign in to comment.