chore: config load env

This commit is contained in:
monoid 2024-04-17 00:27:51 +09:00
parent fbc4fb75e8
commit 017e081b70

View File

@ -1,9 +1,11 @@
import { defineConfig } from 'vite' import { defineConfig, loadEnv } from 'vite'
import path from 'node:path' import path from 'node:path'
import react from '@vitejs/plugin-react-swc' import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
plugins: [react()], plugins: [react()],
resolve: { resolve: {
alias: { alias: {
@ -12,7 +14,7 @@ export default defineConfig({
}, },
server: { server: {
proxy: { proxy: {
'/api': "https://aeolian.prelude.duckdns.org" '/api': env.API_BASE_URL ?? 'http://localhost:8000',
} }
} }
}) }})