refactor(projects): 细节优化

This commit is contained in:
Soybean
2022-04-27 22:27:46 +08:00
parent e899914426
commit c275f2632c
10 changed files with 87 additions and 91 deletions

View File

@@ -1,6 +1,7 @@
import { fileURLToPath } from 'url';
import { defineConfig, loadEnv } from 'vite';
import { viteDefine, setupVitePlugins, createViteProxy } from './build';
import { getEnvConfig } from './.env-config';
export default defineConfig(configEnv => {
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as ImportMetaEnv;
@@ -8,6 +9,9 @@ export default defineConfig(configEnv => {
const rootPath = fileURLToPath(new URL('./', import.meta.url));
const srcPath = `${rootPath}src`;
const isOpenProxy = viteEnv.VITE_HTTP_PROXY === 'true';
const envConfig = getEnvConfig(viteEnv);
return {
base: viteEnv.VITE_BASE_URL,
resolve: {
@@ -29,7 +33,7 @@ export default defineConfig(configEnv => {
host: '0.0.0.0',
port: 3200,
open: true,
proxy: createViteProxy(viteEnv)
proxy: createViteProxy(isOpenProxy, envConfig)
},
build: {
brotliSize: false