Skip to content

Commit

Permalink
fix:Add storeToRefs Nuxt auto import
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackCrowxyz committed Sep 26, 2023
1 parent 4b9d813 commit d37366e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/nuxt/playground/domain/one/stores/testStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
// import { storeToRefs } from "pinia"

export const useTestStore = defineStore('test', () => {
console.log('I was defined within a store directory')

// Should work without any error or importing
const { count, getCount } = storeToRefs(useCounter())
console.log('storeToRefs works without importing (Nuxt) !', count.value === getCount.value)

return {}
})
1 change: 1 addition & 0 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
{ from: composables, name: 'defineStore' },
{ from: composables, name: 'acceptHMRUpdate' },
{ from: composables, name: 'usePinia' },
{ from: composables, name: 'storeToRefs' },
])

if (options.storesDirs) {
Expand Down

0 comments on commit d37366e

Please sign in to comment.