|
|
@@ -1,6 +1,5 @@
|
|
|
-import { App } from 'vue';
|
|
|
export default {
|
|
|
- async install(app: App<Element>): Promise<void> {
|
|
|
+ async install(app: any): Promise<void> {
|
|
|
/** webpack */
|
|
|
// const files = require.context('@/packages', true, /index\.vue$/);
|
|
|
// files.keys().forEach(component => {
|
|
|
@@ -9,11 +8,9 @@ export default {
|
|
|
// });
|
|
|
|
|
|
/** vite */
|
|
|
- const modulesPage = import.meta.glob('/src/packages/**/index.vue');
|
|
|
- for (const path in modulesPage) {
|
|
|
- let name = (/packages\/(.*)\/index.vue/.exec(path) as any[])[1];
|
|
|
- let res: any = await modulesPage[path]();
|
|
|
- const componentEntity = res?.default;
|
|
|
+ const modules = import.meta.globEager('/src/packages/**/index.vue');
|
|
|
+ for (const key in modules) {
|
|
|
+ const componentEntity = modules[key]?.default;
|
|
|
app.component(componentEntity.name, componentEntity);
|
|
|
}
|
|
|
}
|