File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import { defu } from 'defu'
11
11
/**
12
12
* This plugin adds all the Nuxt UI components as auto-imports.
13
13
*/
14
- export default function ComponentImportPlugin ( options : NuxtUIOptions & { prefix : NonNullable < NuxtUIOptions [ 'prefix' ] > } , meta : UnpluginContextMeta ) {
14
+ export default function ComponentImportPlugin ( options : NuxtUIOptions & { prefix : NonNullable < NuxtUIOptions [ 'prefix' ] > , extraRuntimeDir ?: string } , meta : UnpluginContextMeta ) {
15
15
const components = globSync ( '**/*.vue' , { cwd : join ( runtimeDir , 'components' ) } )
16
16
const componentNames = new Set ( components . map ( c => `${ options . prefix } ${ c . replace ( / \. v u e $ / , '' ) } ` ) )
17
17
@@ -50,13 +50,15 @@ export default function ComponentImportPlugin(options: NuxtUIOptions & { prefix:
50
50
name : 'nuxt:ui:components' ,
51
51
enforce : 'pre' ,
52
52
resolveId ( id , importer ) {
53
- // only apply to runtime nuxt ui components
54
- if ( ! importer || ! normalize ( importer ) . includes ( runtimeDir ) ) {
53
+ if ( ! importer ) {
54
+ return
55
+ }
56
+ if ( ! normalize ( importer ) . includes ( runtimeDir ) && ( ! options . extraRuntimeDir || ! normalize ( importer ) . includes ( options . extraRuntimeDir ) ) ) {
55
57
return
56
58
}
57
59
58
- // only apply to relative imports
59
- if ( ! RELATIVE_IMPORT_RE . test ( id ) ) {
60
+ // only apply to relative imports or nuxt ui runtime components
61
+ if ( ! RELATIVE_IMPORT_RE . test ( id ) && ! id . startsWith ( '@nuxt/ui/components/' ) ) {
60
62
return
61
63
}
62
64
You can’t perform that action at this time.
0 commit comments