1
0

update for astro

This commit is contained in:
2025-07-26 15:31:43 +08:00
parent 90126beb35
commit 51733f3f2e
50 changed files with 8300 additions and 12 deletions

47
official/astro.config.mjs Normal file
View File

@@ -0,0 +1,47 @@
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import react from '@astrojs/react';
import sitemap from '@astrojs/sitemap';
import pkgs from './package.json';
import tailwindcss from '@tailwindcss/vite';
const isDev = process.env.NODE_ENV === 'development';
const plugins = [tailwindcss()];
let target = process.env.VITE_API_URL || 'https://localhost:51015';
const apiProxy = { target: target, changeOrigin: true, ws: true, rewriteWsOrigin: true, secure: false, cookieDomainRewrite: 'localhost' };
let proxy = {
'/root/center/': {
target: `${target}/root/center/`,
},
'/user/login/': {
target: `${target}/user/login/`,
},
'/api': apiProxy,
'/client': apiProxy,
};
export default defineConfig({
// ...
site: 'https://www.kevisual.cn/',
// base: isDev ? undefined : pkgs.basename,
base: './',
integrations: [
mdx(),
react(), //
sitemap(), // sitemap must be site has a domain
],
vite: {
plugins,
define: {
BASE_NAME: JSON.stringify(pkgs.basename),
},
server: {
port: 7008,
host: '0.0.0.0',
allowedHosts: true,
proxy,
},
},
});