File tree Expand file tree Collapse file tree 5 files changed +21
-12
lines changed Expand file tree Collapse file tree 5 files changed +21
-12
lines changed Original file line number Diff line number Diff line change 11import type { Options } from "../types" ;
2- import { iconLibraryName , libraryName , prefix } from "../config"
2+ import { prefix } from "../config"
33import { addComponent } from "@nuxt/kit" ;
44
5- export const resolveComponents = ( config :Options ) => {
5+ export const resolveComponents = ( config :Options , filePath : string ) => {
6+
67 const { components, icons } = config ;
78 const allComponents = components === false ? [ ] : components ;
89 allComponents . forEach ( component => {
910 if ( typeof component === 'string' ) {
1011 addComponent ( {
1112 export : component ,
1213 name : prefix + component ,
13- filePath : libraryName + '/es'
14+ filePath
1415 } )
1516 } else if ( Array . isArray ( component ) ) {
1617 addComponent ( {
1718 export : component [ 0 ] ,
1819 name : prefix + component [ 1 ] ,
19- filePath : libraryName + '/es'
20+ filePath
2021 } )
2122 }
2223 } )
@@ -29,13 +30,13 @@ export const resolveComponents = (config:Options) =>{
2930 addComponent ( {
3031 export : icon ,
3132 name : icon ,
32- filePath : iconLibraryName
33+ filePath
3334 } )
3435 } else if ( Array . isArray ( icon ) ) {
3536 addComponent ( {
3637 export : icon [ 0 ] ,
3738 name : icon [ 1 ] ,
38- filePath : iconLibraryName
39+ filePath
3940 } )
4041 }
4142 } )
Original file line number Diff line number Diff line change 11import { addImportsSources } from "@nuxt/kit" ;
22import type { Options } from "../types" ;
3- import { libraryName } from "../config" ;
43
5- export const resolveImports = ( config :Options ) => {
4+ export const resolveImports = ( config :Options , filePath : string ) => {
65 const { imports } = config
76 const allImports = imports ? imports : [ ]
87 addImportsSources ( {
9- from : libraryName + '/es' ,
8+ from : filePath ,
109 imports : [ ...allImports ]
1110 } )
1211}
Original file line number Diff line number Diff line change @@ -16,9 +16,13 @@ export function resolveOptions () {
1616 resolve :{
1717 alias :[
1818 {
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 ) ) / ,
2020 replacement : 'ant-design-vue/es' ,
2121 } ,
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+ } ,
2226 {
2327 find : / ^ d a y j s \/ p l u g i n \/ ( .* ) $ / ,
2428 replacement : 'dayjs/esm/plugin/$1' ,
Original file line number Diff line number Diff line change @@ -15,10 +15,13 @@ export default defineNuxtModule<Partial<Options>>({
1515 const options = _options as Options ;
1616
1717 resolveOptions ( )
18+
19+ const antdRuntimePath = createResolver ( import . meta. url ) . resolve ( './runtime/antd' )
20+
1821 // 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 )
2023 // eslint-disable-next-line @typescript-eslint/no-unused-expressions
21- nuxt . options . components !== false && resolveComponents ( options )
24+ nuxt . options . components !== false && resolveComponents ( options , antdRuntimePath )
2225
2326 if ( options . extractStyle ) {
2427 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