mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-12 19:58:10 +00:00
docs: clarify that local layers are scanned from rootDir
resolves https://github.com/nuxt/nuxt/issues/30925
This commit is contained in:
parent
3af848f9a6
commit
27e356fe67
@ -18,7 +18,7 @@ One of the core features of Nuxt is the layers and extending support. You can ex
|
|||||||
|
|
||||||
## Usage
|
## 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
|
::note
|
||||||
Layer auto-registration was introduced in Nuxt v3.12.0
|
Layer auto-registration was introduced in Nuxt v3.12.0
|
||||||
|
@ -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),
|
...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(/\/?$/, '/'))
|
const locallyScannedLayersDirs = nuxt.options._layers.map(l => resolve(l.cwd, 'layers').replace(/\/?$/, '/'))
|
||||||
nuxt.options.modulesDir.push(...nuxt.options._layers
|
nuxt.options.modulesDir.push(...nuxt.options._layers
|
||||||
.filter(l => l.cwd !== nuxt.options.rootDir && locallyScannedLayersDirs.every(dir => !l.cwd.startsWith(dir)))
|
.filter(l => l.cwd !== nuxt.options.rootDir && locallyScannedLayersDirs.every(dir => !l.cwd.startsWith(dir)))
|
||||||
|
Loading…
Reference in New Issue
Block a user