File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 3
3
addServerHandler ,
4
4
createResolver ,
5
5
defineNuxtModule ,
6
- resolveModule ,
6
+ tryResolveModule ,
7
7
addImportsDir ,
8
8
addTemplate
9
9
} from '@nuxt/kit'
@@ -111,13 +111,16 @@ export default defineNuxtModule<ModuleOptions>({
111
111
let components : Component [ ] = [ ]
112
112
let metaSources : NuxtComponentMeta = { }
113
113
114
+ const uiTemplatesPath = await tryResolveModule ( '@nuxt/ui-templates' )
114
115
nuxt . hook ( 'components:dirs' , ( dirs ) => {
115
116
componentDirs = [
116
117
...componentDirs ,
117
118
...dirs ,
118
- { path : resolveModule ( 'nuxt' ) . replace ( '/index.mjs' , '/app' ) } ,
119
- { path : resolveModule ( '@nuxt/ui-templates' ) . replace ( '/index.mjs' , '/templates' ) }
119
+ { path : nuxt . options . appDir }
120
120
]
121
+ if ( uiTemplatesPath ) {
122
+ componentDirs . push ( { path : uiTemplatesPath . replace ( '/index.mjs' , '/templates' ) } )
123
+ }
121
124
parserOptions . componentDirs = componentDirs
122
125
} )
123
126
You can’t perform that action at this time.
0 commit comments