Skip to content

Commit f44a05a

Browse files
committed
feat: support Vue JSX
1 parent 2c456d0 commit f44a05a

File tree

6 files changed

+540
-12
lines changed

6 files changed

+540
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ node_modules
1111
dist
1212
dist-ssr
1313
*.local
14+
stats.html
1415

1516
# Editor directories and files
1617
.vscode

components.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ import '@vue/runtime-core'
55

66
declare module '@vue/runtime-core' {
77
export interface GlobalComponents {
8-
VanButton: typeof import('vant/es')['Button']
98
VanCell: typeof import('vant/es')['Cell']
109
VanCellGroup: typeof import('vant/es')['CellGroup']
1110
VanConfigProvider: typeof import('vant/es')['ConfigProvider']
12-
VanIcon: typeof import('vant/es')['Icon']
1311
VanNavBar: typeof import('vant/es')['NavBar']
1412
VanSwitch: typeof import('vant/es')['Switch']
1513
VanTag: typeof import('vant/es')['Tag']

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@typescript-eslint/eslint-plugin": "^5.27.1",
3030
"@typescript-eslint/parser": "^5.27.1",
3131
"@vitejs/plugin-vue": "^2.3.3",
32+
"@vitejs/plugin-vue-jsx": "^1.3.10",
3233
"@vue/eslint-config-typescript": "^10.0.0",
3334
"autoprefixer": "^10.4.7",
3435
"consola": "^2.15.3",
@@ -42,7 +43,8 @@
4243
"mockjs": "^1.1.0",
4344
"plop": "^3.1.0",
4445
"postcss-px-to-viewport-8-plugin": "^1.1.3",
45-
"typescript": "4.7.3",
46+
"rollup-plugin-visualizer": "^5.6.0",
47+
"typescript": "^4.7.3",
4648
"umi-mock-middleware2": "^1.0.2",
4749
"unplugin-vue-components": "^0.19.6",
4850
"vite": "^2.9.9",

src/views/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<van-cell-group inset>
44
<van-cell center title="暗黑模式">
55
<template #right-icon>
6-
<van-switch v-model="checked" size="20px" />
6+
<van-switch v-model="checked" size="18px" />
77
</template>
88
</van-cell>
99

vite.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import type { ConfigEnv, UserConfig } from 'vite'
21
import { loadEnv } from 'vite'
3-
import path from 'path'
42
import vue from '@vitejs/plugin-vue'
3+
import vueJsx from '@vitejs/plugin-vue-jsx'
4+
import type { ConfigEnv, UserConfig } from 'vite'
5+
import { visualizer } from 'rollup-plugin-visualizer'
56
import Components from 'unplugin-vue-components/vite'
67
import { VantResolver } from 'unplugin-vue-components/resolvers'
78
import createMockServer from './build/mockServer'
9+
import path from 'path'
810

911
// https://vitejs.dev/config/
1012
export default ({ mode }: ConfigEnv): UserConfig => {
@@ -22,6 +24,8 @@ export default ({ mode }: ConfigEnv): UserConfig => {
2224
// https://github.com/vuejs/rfcs/discussions/369.
2325
// reactivityTransform: true
2426
}),
27+
vueJsx(),
28+
visualizer(),
2529
Components({
2630
dts: true,
2731
resolvers: [VantResolver()],

0 commit comments

Comments
 (0)