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 {
1919 * @default false
2020 */
2121 resolveIcons ?: boolean
22+
23+ /**
24+ * whether to import ESM version
25+ * @default false
26+ */
27+ esm ?: boolean
2228}
2329
2430function getSideEffects ( importName : string , options : TDesignResolverOptions ) : SideEffectsInfo | undefined {
@@ -80,11 +86,12 @@ export function TDesignResolver(options: TDesignResolverOptions = {}): Component
8086 type : 'component' ,
8187 resolve : ( name : string ) => {
8288 const { library = 'vue' } = options
89+ const importFrom = options . esm ? '/esm' : ''
8390
8491 if ( options . resolveIcons && name . match ( / [ a - z ] I c o n $ / ) ) {
8592 return {
8693 name,
87- from : `tdesign-icons-${ library } ` ,
94+ from : `tdesign-icons-${ library } ${ importFrom } ` ,
8895 }
8996 }
9097
@@ -93,7 +100,7 @@ export function TDesignResolver(options: TDesignResolverOptions = {}): Component
93100
94101 return {
95102 name : importName ,
96- from : `tdesign-${ library } ` ,
103+ from : `tdesign-${ library } ${ importFrom } ` ,
97104 sideEffects : getSideEffects ( importName , options ) ,
98105 }
99106 }
You can’t perform that action at this time.
0 commit comments