File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1- import { mkdir , readFile } from 'node:fs/promises'
1+ import { mkdir , readFile , stat } from 'node:fs/promises'
22import {
33 defineNuxtModule ,
44 createResolver ,
@@ -133,6 +133,18 @@ export default defineNuxtModule<ModuleOptions>({
133133 nuxt . options . alias [ '#content/components' ] = addTemplate ( componentsManifestTemplate ( manifest ) ) . dst
134134 nuxt . options . alias [ '#content/manifest' ] = addTemplate ( manifestTemplate ( manifest ) ) . dst
135135
136+ // Register user components
137+ const _layers = [ ...nuxt . options . _layers ] . reverse ( )
138+ for ( const layer of _layers ) {
139+ const path = resolver . resolve ( layer . config . srcDir , 'components/content' )
140+ const dirStat = await stat ( path ) . catch ( ( ) => null )
141+ if ( dirStat && dirStat . isDirectory ( ) ) {
142+ nuxt . hook ( 'components:dirs' , ( dirs ) => {
143+ dirs . unshift ( { path, pathPrefix : false , prefix : '' } )
144+ } )
145+ }
146+ }
147+
136148 // Load preset
137149 nuxt . hook ( 'nitro:config' , async ( config ) => {
138150 const preset = findPreset ( nuxt )
You can’t perform that action at this time.
0 commit comments