docs: clarify that local layers are scanned from rootDir

resolves https://github.com/nuxt/nuxt/issues/30925
This commit is contained in:
Daniel Roe 2025-02-10 21:36:43 +00:00
parent 3af848f9a6
commit 27e356fe67
No known key found for this signature in database
GPG Key ID: CBC814C393D93268
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ One of the core features of Nuxt is the layers and extending support. You can ex
## Usage
By default, any layers within your project in the `~/layers` directory will be automatically registered as layers in your project
By default, any layers within your project in the `~~/layers` directory will be automatically registered as layers in your project
::note
Layer auto-registration was introduced in Nuxt v3.12.0

View File

@ -453,7 +453,7 @@ async function initNuxt (nuxt: Nuxt) {
...nuxt.options._layers.filter(i => i.cwd.includes('node_modules')).map(i => i.cwd as string),
)
// Ensure we can resolve dependencies within layers - filtering out local `~/layers` directories
// Ensure we can resolve dependencies within layers - filtering out local `~~/layers` directories
const locallyScannedLayersDirs = nuxt.options._layers.map(l => resolve(l.cwd, 'layers').replace(/\/?$/, '/'))
nuxt.options.modulesDir.push(...nuxt.options._layers
.filter(l => l.cwd !== nuxt.options.rootDir && locallyScannedLayersDirs.every(dir => !l.cwd.startsWith(dir)))