web-projects/astro.config.mjs
wangdl 16cce4152c
All checks were successful
Deploy Website / build-and-deploy (push) Successful in 8m54s
feat: Astro 开发模式 API 代理到本地 :3000
2026-06-27 12:55:02 +08:00

25 lines
507 B
JavaScript

import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
const host = process.env.HOST || 'localhost';
const port = process.env.PORT || '4321';
const apiUrl = process.env.API_URL || 'http://127.0.0.1:3000';
export default defineConfig({
site: process.env.SITE_URL || `http://${host}:${port}`,
server: {
host,
port: parseInt(port, 10),
},
vite: {
plugins: [tailwindcss()],
server: {
proxy: {
'/api': apiUrl,
},
},
},
});