Skip to content

Commit 97d2799

Browse files
committed
fix(nuxt): auto imports from layers
1 parent a734efe commit 97d2799

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/nuxt/src/module.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
addImports,
88
createResolver,
99
addImportsDir,
10+
getLayerDirectories,
1011
} from '@nuxt/kit'
1112
import type { NuxtModule } from '@nuxt/schema'
1213
import { fileURLToPath } from 'node:url'
@@ -73,8 +74,14 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
7374
}
7475

7576
if (options.storesDirs) {
77+
const layers = getLayerDirectories(nuxt)
78+
7679
for (const storeDir of options.storesDirs) {
7780
addImportsDir(resolve(nuxt.options.rootDir, storeDir))
81+
82+
for (const layer of layers) {
83+
addImportsDir(resolve(layer.app, storeDir))
84+
}
7885
}
7986
}
8087
},

0 commit comments

Comments
 (0)