Skip to content

Commit af843f0

Browse files
committed
minimize build size
1 parent 53427ec commit af843f0

File tree

7 files changed

+141
-22
lines changed

7 files changed

+141
-22
lines changed

auto-imports.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* eslint-disable */
2+
/* prettier-ignore */
3+
// @ts-nocheck
4+
// noinspection JSUnusedGlobalSymbols
5+
// Generated by unplugin-auto-import
6+
// biome-ignore lint: disable
7+
export {}
8+
declare global {
9+
10+
}

bun.lock

Lines changed: 75 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* eslint-disable */
2+
// @ts-nocheck
3+
// biome-ignore lint: disable
4+
// oxlint-disable
5+
// ------
6+
// Generated by unplugin-vue-components
7+
// Read more: https://github.com/vuejs/core/pull/3399
8+
9+
export {}
10+
11+
/* prettier-ignore */
12+
declare module 'vue' {
13+
export interface GlobalComponents {
14+
ElAlert: typeof import('element-plus/es')['ElAlert']
15+
ElAvatar: typeof import('element-plus/es')['ElAvatar']
16+
ElButton: typeof import('element-plus/es')['ElButton']
17+
ElIcon: typeof import('element-plus/es')['ElIcon']
18+
ElStep: typeof import('element-plus/es')['ElStep']
19+
ElSteps: typeof import('element-plus/es')['ElSteps']
20+
ElTable: typeof import('element-plus/es')['ElTable']
21+
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
22+
ElTabPane: typeof import('element-plus/es')['ElTabPane']
23+
ElTabs: typeof import('element-plus/es')['ElTabs']
24+
RouterLink: typeof import('vue-router')['RouterLink']
25+
RouterView: typeof import('vue-router')['RouterView']
26+
}
27+
}

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,17 @@
2424
"@vue/tsconfig": "^0.9.0",
2525
"npm-run-all2": "^8.0.4",
2626
"typescript": "~5.9.3",
27+
"unplugin-auto-import": "^21.0.0",
28+
"unplugin-icons": "^23.0.1",
29+
"unplugin-vue-components": "^31.0.0",
2730
"vite": "^7.3.1",
2831
"vite-plugin-vue-devtools": "^8.0.6",
2932
"vue-tsc": "^3.2.5"
3033
},
34+
"overrides": {
35+
"unimport": "latest",
36+
"strip-literal": "latest"
37+
},
3138
"engines": {
3239
"node": "^20.19.0 || >=22.12.0"
3340
}

src/main.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { createApp } from 'vue';
2-
import ElementPlus from 'element-plus';
3-
import 'element-plus/dist/index.css';
4-
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
52
import router from './router';
63
import App from './App.vue';
74
import './assets/style.css';
@@ -30,11 +27,5 @@ addIcons(
3027

3128
const app = createApp(App);
3229
app.component('v-icon', OhVueIcon);
33-
34-
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
35-
app.component(key, component);
36-
}
37-
38-
app.use(ElementPlus);
3930
app.use(router);
4031
app.mount('#app');

src/router/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
createWebHistory,
44
type RouteRecordRaw,
55
} from 'vue-router';
6-
import Home from '../views/Home.vue';
6+
const Home = () => import('../views/Home.vue');
77

88
const routes: Array<RouteRecordRaw> = [
99
{

vite.config.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
import { fileURLToPath, URL } from 'node:url'
1+
import { fileURLToPath, URL } from 'node:url';
22

3-
import { defineConfig } from 'vite'
4-
import vue from '@vitejs/plugin-vue'
5-
import vueDevTools from 'vite-plugin-vue-devtools'
3+
import { defineConfig } from 'vite';
4+
import vue from '@vitejs/plugin-vue';
5+
import vueDevTools from 'vite-plugin-vue-devtools';
6+
import AutoImport from 'unplugin-auto-import/vite';
7+
import Components from 'unplugin-vue-components/vite';
8+
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
9+
import Icons from 'unplugin-icons/vite';
10+
import IconsResolver from 'unplugin-icons/resolver';
611

712
// https://vite.dev/config/
813
export default defineConfig({
914
plugins: [
1015
vue(),
1116
vueDevTools(),
17+
AutoImport({
18+
resolvers: [ElementPlusResolver(), IconsResolver({ prefix: 'Icon' })],
19+
}),
20+
Components({
21+
resolvers: [
22+
ElementPlusResolver(),
23+
IconsResolver({ enabledCollections: ['ep'] }),
24+
],
25+
}),
26+
Icons({ autoInstall: true }),
1227
],
1328
resolve: {
1429
alias: {
15-
'@': fileURLToPath(new URL('./src', import.meta.url))
30+
'@': fileURLToPath(new URL('./src', import.meta.url)),
1631
},
1732
},
18-
})
33+
});

0 commit comments

Comments
 (0)