@nuxt/docs-nightly 4.2.0-29344154.f3dc0780 → 4.2.0-29344217.2658cf12
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,22 +234,30 @@ 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 [`getLayerDirectories`](/docs/4.x/api/kit/layers#getlayerdirectories) utility from Nuxt Kit 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
|
+
|
|
240
242
|
export default defineNuxtModule({
|
|
241
243
|
setup (_options, nuxt) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
244
|
+
const layerDirs = getLayerDirectories()
|
|
245
|
+
|
|
246
|
+
for (const [index, layer] of layerDirs.entries()) {
|
|
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
|
|
245
253
|
}
|
|
246
254
|
},
|
|
247
255
|
})
|
|
248
256
|
```
|
|
249
257
|
|
|
250
258
|
**Notes:**
|
|
251
|
-
- Earlier items in the
|
|
252
|
-
- The user's project is the first item in the
|
|
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
|
|
253
261
|
|
|
254
262
|
## Going Deeper
|
|
255
263
|
|