@nuxt/docs-nightly 4.2.0-29344147.7bcc4ca3 → 4.2.0-29344154.f3dc0780
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -234,30 +234,22 @@ export default defineNuxtConfig({
|
|
|
234
234
|
|
|
235
235
|
## Multi-Layer Support for Nuxt Modules
|
|
236
236
|
|
|
237
|
-
You can use the
|
|
237
|
+
You can use the internal array `nuxt.options._layers` to support custom multi-layer handling for your modules.
|
|
238
238
|
|
|
239
239
|
```ts [modules/my-module.ts]
|
|
240
|
-
import { defineNuxtModule, getLayerDirectories } from 'nuxt/kit'
|
|
241
|
-
|
|
242
240
|
export default defineNuxtModule({
|
|
243
241
|
setup (_options, nuxt) {
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
console.log(`Layer ${index}:`)
|
|
248
|
-
console.log(` Root: ${layer.root}`)
|
|
249
|
-
console.log(` App: ${layer.app}`)
|
|
250
|
-
console.log(` Server: ${layer.server}`)
|
|
251
|
-
console.log(` Pages: ${layer.appPages}`)
|
|
252
|
-
// ... other directories
|
|
242
|
+
for (const layer of nuxt.options._layers) {
|
|
243
|
+
// You can check for a custom directory existence to extend for each layer
|
|
244
|
+
console.log('Custom extension for', layer.cwd, layer.config)
|
|
253
245
|
}
|
|
254
246
|
},
|
|
255
247
|
})
|
|
256
248
|
```
|
|
257
249
|
|
|
258
250
|
**Notes:**
|
|
259
|
-
- Earlier items in the array have higher priority and override later ones
|
|
260
|
-
- The user's project is the first item in the array
|
|
251
|
+
- Earlier items in the `_layers` array have higher priority and override later ones
|
|
252
|
+
- The user's project is the first item in the `_layers` array
|
|
261
253
|
|
|
262
254
|
## Going Deeper
|
|
263
255
|
|