feat: supports imports option for auto-import (#12861)

Co-authored-by: 赵江江 <zhaojiangjiang@kingyee.com.cn>
This commit is contained in:
zhaojjiang
2024-05-18 20:39:28 +08:00
committed by GitHub
co-authored by 赵江江
parent 413150a4ab
commit 96cbb04bc0
5 changed files with 68 additions and 30 deletions
@@ -23,6 +23,8 @@ export interface VantResolverOptions {
ssr?: boolean;
}
export type VantImportsOptions = Pick<VantResolverOptions, 'module' | 'ssr'>;
/**
* Button->button; ButtonGroup->button-group
*/
@@ -124,3 +126,11 @@ export function VantResolver(options: VantResolverOptions = {}) {
},
};
}
export function VantImports(options: VantImportsOptions = {}) {
const moduleType = getModuleType(options);
return {
[`vant/${moduleType}`]: getAPIMap().keys(),
};
}