Skip to content

Commit

Permalink
fix: Nuxt component registration (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede authored May 30, 2024
1 parent 2399990 commit 0650606
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export * from './presets'
// Typings
export * from './types'

// Components
export * from './components'

// Composables
export { reactiveStyle } from './reactiveStyle'
export { reactiveTransform } from './reactiveTransform'
Expand Down
15 changes: 14 additions & 1 deletion src/nuxt/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defu } from 'defu'
import { addImportsDir, addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit'
import { addComponent, addImportsDir, addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit'
import type { NuxtModule } from '@nuxt/schema'
import type { ModuleOptions as MotionModuleOpts } from '../types'

Expand All @@ -23,6 +23,19 @@ export default defineNuxtModule<ModuleOptions>({
// Add auto imports
addImportsDir(resolve('./runtime/composables'))

// Add components
addComponent({
name: 'Motion',
export: 'MotionComponent',
filePath: '@vueuse/motion',
})

addComponent({
name: 'MotionGroup',
export: 'MotionGroupComponent',
filePath: '@vueuse/motion',
})

// Transpile necessary packages
if (!nuxt.options.build.transpile)
nuxt.options.build.transpile = []
Expand Down

0 comments on commit 0650606

Please sign in to comment.