Skip to content

Commit 13f232f

Browse files
yangyanggusxzz
andauthored
feat(element-plus): add exclude option (#296) (#296)
Co-authored-by: 三咲智子 <[email protected]>
1 parent 1d947da commit 13f232f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/core/resolvers/element-plus.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ export interface ElementPlusResolverOptions {
2828
* @default true
2929
*/
3030
directives?: boolean
31+
32+
/**
33+
* exclude component name, if match do not resolve the name
34+
* @default null
35+
*/
36+
exclude?: RegExp
3137
}
3238

3339
type ElementPlusResolverOptionsResolved = Required<ElementPlusResolverOptions>
@@ -73,6 +79,9 @@ function getSideEffects(dirName: string, options: ElementPlusResolverOptionsReso
7379
}
7480

7581
function resolveComponent(name: string, options: ElementPlusResolverOptionsResolved): ComponentInfo | undefined {
82+
if (options.exclude && name.match(options.exclude))
83+
return
84+
7685
if (!name.match(/^El[A-Z]/))
7786
return
7887

@@ -150,6 +159,7 @@ export function ElementPlusResolver(
150159
version: await getPkgVersion('element-plus', '1.1.0-beta.21'),
151160
importStyle: 'css',
152161
directives: true,
162+
excludeReg: null,
153163
...options,
154164
}
155165
return optionsResolved

0 commit comments

Comments
 (0)