diff --git a/package.json b/package.json index be536ee..26288ca 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "@vitejs/plugin-vue-jsx": "^2.0.1", "@vitest/coverage-c8": "^0.22.1", "@vitest/ui": "^0.22.1", + "@vue-macros/reactivity-transform": "^0.3.10", "@vue/cli-plugin-unit-jest": "4.5.17", "@vue/cli-service": "4.5.17", "@vue/test-utils": "^2.0.2", diff --git a/vite.config.ts b/vite.config.ts index b55358f..44c85ad 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -10,6 +10,7 @@ import { presetAttributify, presetIcons, presetUno } from 'unocss' import mkcert from 'vite-plugin-mkcert' import AutoImport from 'unplugin-auto-import/vite' import setting from './src/settings' +import ReactivityTransform from '@vue-macros/reactivity-transform/vite' const prodMock = setting.openProdMock import vitePluginSetupExtend from './src/plugins/vite-plugin-setup-extend' import vitePluginVueSetupExtend from 'vite-plugin-vue-setup-extend' @@ -26,7 +27,7 @@ export default defineConfig(({ command, mode }) => { }, clearScreen: false, //设为 false 可以避免 Vite 清屏而错过在终端中打印某些关键信息 server: { - hmr: { overlay: false }, //设置 server.hmr.overlay 为 false 可以禁用开发服务器错误的屏蔽。方便错误查看 + //hmr: { overlay: false }, //设置 server.hmr.overlay 为 false 可以禁用开发服务器错误的屏蔽。方便错误查看 port: 5005, // 类型: number 指定服务器端口; open: false, // 类型: boolean | string在服务器启动时自动在浏览器中打开应用程序; host: true, @@ -38,8 +39,9 @@ export default defineConfig(({ command, mode }) => { strictPort: true }, plugins: [ - vue({ reactivityTransform: true }), + vue(), vueJsx(), + ReactivityTransform(), UnoCSS({ presets: [presetUno(), presetAttributify(), presetIcons()] }), @@ -55,7 +57,6 @@ export default defineConfig(({ command, mode }) => { }), //https://github.com/anncwb/vite-plugin-mock/blob/HEAD/README.zh_CN.md viteMockServe({ - supportTs: true, mockPath: 'mock', localEnabled: command === 'serve', prodEnabled: prodMock,