feat:配置host

This commit is contained in:
tantao 2022-08-25 14:41:15 +08:00
parent 9ee91892ed
commit 2ef5ad0f03

View File

@ -1,12 +1,12 @@
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from "path";
import styleImport, { VantResolve } from 'vite-plugin-style-import';
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
// 检查process.cwd()路径下.env.develeport.local、.env.development、.env.local、.env这四个环境文件
loadEnv(mode, process.cwd())
loadEnv(mode, process.cwd());
return {
// 静态资源基础路径 base: './' || '',
@ -32,6 +32,7 @@ export default defineConfig(({command, mode})=>{
// 跨域代理
server: {
host: '0.0.0.0',
proxy: {
//这里是通过请求/api 来转发到 https://api.pingping6.com/
//假如你要请求https://api.*.com/a/a
@ -39,5 +40,5 @@ export default defineConfig(({command, mode})=>{
'/api': ''
}
}
}
})
};
});