File tree 5 files changed +21
-12
lines changed
5 files changed +21
-12
lines changed Original file line number Diff line number Diff line change 1
1
import type { Options } from "../types" ;
2
- import { iconLibraryName , libraryName , prefix } from "../config"
2
+ import { prefix } from "../config"
3
3
import { addComponent } from "@nuxt/kit" ;
4
4
5
- export const resolveComponents = ( config :Options ) => {
5
+ export const resolveComponents = ( config :Options , filePath : string ) => {
6
+
6
7
const { components, icons } = config ;
7
8
const allComponents = components === false ? [ ] : components ;
8
9
allComponents . forEach ( component => {
9
10
if ( typeof component === 'string' ) {
10
11
addComponent ( {
11
12
export : component ,
12
13
name : prefix + component ,
13
- filePath : libraryName + '/es'
14
+ filePath
14
15
} )
15
16
} else if ( Array . isArray ( component ) ) {
16
17
addComponent ( {
17
18
export : component [ 0 ] ,
18
19
name : prefix + component [ 1 ] ,
19
- filePath : libraryName + '/es'
20
+ filePath
20
21
} )
21
22
}
22
23
} )
@@ -29,13 +30,13 @@ export const resolveComponents = (config:Options) =>{
29
30
addComponent ( {
30
31
export : icon ,
31
32
name : icon ,
32
- filePath : iconLibraryName
33
+ filePath
33
34
} )
34
35
} else if ( Array . isArray ( icon ) ) {
35
36
addComponent ( {
36
37
export : icon [ 0 ] ,
37
38
name : icon [ 1 ] ,
38
- filePath : iconLibraryName
39
+ filePath
39
40
} )
40
41
}
41
42
} )
Original file line number Diff line number Diff line change 1
1
import { addImportsSources } from "@nuxt/kit" ;
2
2
import type { Options } from "../types" ;
3
- import { libraryName } from "../config" ;
4
3
5
- export const resolveImports = ( config :Options ) => {
4
+ export const resolveImports = ( config :Options , filePath : string ) => {
6
5
const { imports } = config
7
6
const allImports = imports ? imports : [ ]
8
7
addImportsSources ( {
9
- from : libraryName + '/es' ,
8
+ from : filePath ,
10
9
imports : [ ...allImports ]
11
10
} )
12
11
}
Original file line number Diff line number Diff line change @@ -16,9 +16,13 @@ export function resolveOptions () {
16
16
resolve :{
17
17
alias :[
18
18
{
19
- find : / ^ ( a n t - d e s i g n - v u e ) (? ! \/ ( e s | d i s t ) ) / ,
19
+ find : / ^ ( a n t - d e s i g n - v u e ) (? ! \/ ( e s | l i b ) ) / ,
20
20
replacement : 'ant-design-vue/es' ,
21
21
} ,
22
+ {
23
+ find : / ^ @ a n t - d e s i g n \/ i c o n s - v u e $ / ,
24
+ replacement : '@ant-design/icons-vue' ,
25
+ } ,
22
26
{
23
27
find : / ^ d a y j s \/ p l u g i n \/ ( .* ) $ / ,
24
28
replacement : 'dayjs/esm/plugin/$1' ,
Original file line number Diff line number Diff line change @@ -15,10 +15,13 @@ export default defineNuxtModule<Partial<Options>>({
15
15
const options = _options as Options ;
16
16
17
17
resolveOptions ( )
18
+
19
+ const antdRuntimePath = createResolver ( import . meta. url ) . resolve ( './runtime/antd' )
20
+
18
21
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
19
- nuxt . options . imports . autoImport !== false && resolveImports ( options )
22
+ nuxt . options . imports . autoImport !== false && resolveImports ( options , antdRuntimePath )
20
23
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
21
- nuxt . options . components !== false && resolveComponents ( options )
24
+ nuxt . options . components !== false && resolveComponents ( options , antdRuntimePath )
22
25
23
26
if ( options . extractStyle ) {
24
27
extractStyle ( )
Original file line number Diff line number Diff line change
1
+ export * from 'ant-design-vue/es' ;
2
+ export * from '@ant-design/icons-vue' ;
You can’t perform that action at this time.
0 commit comments