From 61d87e70aa9f49863d7533175e8704361e45bc1b Mon Sep 17 00:00:00 2001 From: talktao Date: Fri, 25 Mar 2022 10:55:01 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E5=A2=9E=E5=8A=A0=20=E9=9D=99?= =?UTF-8?q?=E6=80=81=E8=B5=84=E6=BA=90=E5=9F=BA=E7=A1=80=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8Evite=E6=89=93=E5=8C=85=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E8=B5=84=E6=BA=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index a051b9e..ab14edd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,6 +8,10 @@ export default defineConfig(({command, mode})=>{ // 检查process.cwd()路径下.env.develeport.local、.env.development、.env.local、.env这四个环境文件 loadEnv(mode, process.cwd()) return { + + // 静态资源基础路径 base: './' || '', + base:'./', + resolve: { alias:{ // 配置src目录 @@ -20,9 +24,11 @@ export default defineConfig(({command, mode})=>{ vue(), // 配置后,Vant各组件才生效 styleImport({ - resolves: [VantResolve()], + resolves: [VantResolve()], }), ], + + // 跨域代理 server:{ @@ -30,10 +36,8 @@ export default defineConfig(({command, mode})=>{ //这里是通过请求/api 来转发到 https://api.pingping6.com/ //假如你要请求https://api.*.com/a/a //那么axios的url,可以配置为 /api/a/a - '/api': 'http://192.168.1.187:8080' + '/api': '' } } - } - - + } })