修复一个vite警告

This commit is contained in:
洛洛希雅Lolosia 2023-06-25 14:12:13 +08:00
parent a42a307a81
commit e27e52fa96
2 changed files with 5 additions and 3 deletions

View File

@ -66,6 +66,7 @@
"@vitejs/plugin-vue-jsx": "^2.0.1", "@vitejs/plugin-vue-jsx": "^2.0.1",
"@vitest/coverage-c8": "^0.22.1", "@vitest/coverage-c8": "^0.22.1",
"@vitest/ui": "^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-plugin-unit-jest": "4.5.17",
"@vue/cli-service": "4.5.17", "@vue/cli-service": "4.5.17",
"@vue/test-utils": "^2.0.2", "@vue/test-utils": "^2.0.2",

View File

@ -10,6 +10,7 @@ import { presetAttributify, presetIcons, presetUno } from 'unocss'
import mkcert from 'vite-plugin-mkcert' import mkcert from 'vite-plugin-mkcert'
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
import setting from './src/settings' import setting from './src/settings'
import ReactivityTransform from '@vue-macros/reactivity-transform/vite'
const prodMock = setting.openProdMock const prodMock = setting.openProdMock
import vitePluginSetupExtend from './src/plugins/vite-plugin-setup-extend' import vitePluginSetupExtend from './src/plugins/vite-plugin-setup-extend'
import vitePluginVueSetupExtend from 'vite-plugin-vue-setup-extend' import vitePluginVueSetupExtend from 'vite-plugin-vue-setup-extend'
@ -26,7 +27,7 @@ export default defineConfig(({ command, mode }) => {
}, },
clearScreen: false, //设为 false 可以避免 Vite 清屏而错过在终端中打印某些关键信息 clearScreen: false, //设为 false 可以避免 Vite 清屏而错过在终端中打印某些关键信息
server: { server: {
hmr: { overlay: false }, //设置 server.hmr.overlay 为 false 可以禁用开发服务器错误的屏蔽。方便错误查看 //hmr: { overlay: false }, //设置 server.hmr.overlay 为 false 可以禁用开发服务器错误的屏蔽。方便错误查看
port: 5005, // 类型: number 指定服务器端口; port: 5005, // 类型: number 指定服务器端口;
open: false, // 类型: boolean | string在服务器启动时自动在浏览器中打开应用程序 open: false, // 类型: boolean | string在服务器启动时自动在浏览器中打开应用程序
host: true, host: true,
@ -38,8 +39,9 @@ export default defineConfig(({ command, mode }) => {
strictPort: true strictPort: true
}, },
plugins: [ plugins: [
vue({ reactivityTransform: true }), vue(),
vueJsx(), vueJsx(),
ReactivityTransform(),
UnoCSS({ UnoCSS({
presets: [presetUno(), presetAttributify(), presetIcons()] 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 //https://github.com/anncwb/vite-plugin-mock/blob/HEAD/README.zh_CN.md
viteMockServe({ viteMockServe({
supportTs: true,
mockPath: 'mock', mockPath: 'mock',
localEnabled: command === 'serve', localEnabled: command === 'serve',
prodEnabled: prodMock, prodEnabled: prodMock,