From e27e52fa963b2947532128bf788f7033463d35b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E4=B8=83=E5=B9=B4=E5=A4=8F?= <2098833867@qq.com> Date: Sun, 25 Jun 2023 14:12:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=AAvite?= =?UTF-8?q?=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + vite.config.ts | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) 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,