Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
]
},
"resolutions": {
"@nuxt/kit": "^3.9.0",
"@nuxt/schema": "^3.9.0"
},
"pnpm": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default defineNuxtConfig({})
5 changes: 5 additions & 0 deletions packages/nuxt/playground/layers/layer-domain/stores/basic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const useBasicStore = defineStore('layer-basic', () => {
const count = ref(0)

return { count }
})
5 changes: 3 additions & 2 deletions packages/nuxt/playground/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

const counter = useCounter()

useTestStore()
useSomeStoreStore()
useTestStore() // ~/domain/one/stores/testStore.ts
useSomeStoreStore() // ~/stores/nested/some-stores.ts
useBasicStore() // ~~/layers/layer-domain/stores/basic.ts

// await useAsyncData('counter', () => counter.asyncIncrement().then(() => true))

Expand Down
7 changes: 6 additions & 1 deletion packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
addImports,
createResolver,
addImportsDir,
getLayerDirectories,
} from '@nuxt/kit'
import type { NuxtModule } from '@nuxt/schema'
import { fileURLToPath } from 'node:url'
Expand Down Expand Up @@ -73,8 +74,12 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
}

if (options.storesDirs) {
const layers = getLayerDirectories(nuxt)

for (const storeDir of options.storesDirs) {
addImportsDir(resolve(nuxt.options.rootDir, storeDir))
for (const layer of layers) {
addImportsDir(resolve(layer.app, storeDir))
}
}
}
},
Expand Down
37 changes: 32 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading