File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ export interface TDesignResolverOptions {
19
19
* @default false
20
20
*/
21
21
resolveIcons ?: boolean
22
+
23
+ /**
24
+ * whether to import ESM version
25
+ * @default false
26
+ */
27
+ esm ?: boolean
22
28
}
23
29
24
30
function getSideEffects ( importName : string , options : TDesignResolverOptions ) : SideEffectsInfo | undefined {
@@ -80,11 +86,12 @@ export function TDesignResolver(options: TDesignResolverOptions = {}): Component
80
86
type : 'component' ,
81
87
resolve : ( name : string ) => {
82
88
const { library = 'vue' } = options
89
+ const importFrom = options . esm ? '/esm' : ''
83
90
84
91
if ( options . resolveIcons && name . match ( / [ a - z ] I c o n $ / ) ) {
85
92
return {
86
93
name,
87
- from : `tdesign-icons-${ library } ` ,
94
+ from : `tdesign-icons-${ library } ${ importFrom } ` ,
88
95
}
89
96
}
90
97
@@ -93,7 +100,7 @@ export function TDesignResolver(options: TDesignResolverOptions = {}): Component
93
100
94
101
return {
95
102
name : importName ,
96
- from : `tdesign-${ library } ` ,
103
+ from : `tdesign-${ library } ${ importFrom } ` ,
97
104
sideEffects : getSideEffects ( importName , options ) ,
98
105
}
99
106
}
You can’t perform that action at this time.
0 commit comments