From 24a2563a67edee5f3841a491c6385171de8eba99 Mon Sep 17 00:00:00 2001 From: SuperCuteXiaoSi <1531733886@qq.com> Date: Wed, 12 Jan 2022 23:40:01 +0800 Subject: [PATCH] =?UTF-8?q?fixbug:=20=E6=B3=A8=E9=87=8A=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/vite/server.ts | 8 ++++---- vite.config.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/vite/server.ts b/build/vite/server.ts index 5317973f..78a7b275 100644 --- a/build/vite/server.ts +++ b/build/vite/server.ts @@ -3,17 +3,17 @@ import { ServerOptions } from 'vite'; export function createViteServer(): ServerOptions { const viteServer: ServerOptions = { // 服务器主机名,如果允许外部访问,可设置为"0.0.0.0" - host: '0.0.0.0', + host: true, // 服务器端口号 port: 3000, // 端口已被占用时是否尝试使用下一个可用的端口 true:直接退出,而不是尝试下一个可用端口 false:尝试下一个可用端口 - strictPort: false, + // strictPort: false, // boolean | string 启动项目时自动在浏览器打开应用程序;如果为string,比如"/index.html",会打开http://localhost:3000/index.html // open: true, // boolean | CorsOptions 为开发服务器配置 CORS。默认启用并允许任何源,传递一个 选项对象 来调整行为或设为 false 表示禁用。 - cors: true, + // cors: true, // 设置为 true 强制使依赖预构建。 - force: true, + // force: false, // 自定义代理规则 proxy: { '/api': { diff --git a/vite.config.ts b/vite.config.ts index 2a25060c..6f4cdc4c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,7 @@ import { createVitePlugins } from './build/vite/plugin'; import { createViteResolve } from './build/vite/resolve'; import { createViteBuild } from './build/vite/build'; import { createViteServer } from './build/vite/server'; -import { createViteOptimizeDeps } from './build/vite/optimizeDeps'; +// import { createViteOptimizeDeps } from './build/vite/optimizeDeps'; import { createViteCSS } from './build/vite/css'; export default (configEnv: ConfigEnv): UserConfig => { @@ -30,7 +30,7 @@ export default (configEnv: ConfigEnv): UserConfig => { // 打包配置 build: createViteBuild(), // 依赖优化配置 - optimizeDeps: createViteOptimizeDeps(), + // optimizeDeps: createViteOptimizeDeps(), // css预处理配置 css: createViteCSS(), };