54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
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';
|
|
|
|
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/': {
|
|
target: `${target}/root/`,
|
|
},
|
|
'/api': apiProxy,
|
|
};
|
|
|
|
const basename = isDev ? undefined : `${pkgs.basename}`;
|
|
export default defineConfig({
|
|
base: basename,
|
|
integrations: [
|
|
mdx({
|
|
// MDX 配置选项
|
|
syntaxHighlight: 'shiki', // 或 'prism'
|
|
shikiConfig: {
|
|
theme: 'github-light', // 代码高亮主题
|
|
},
|
|
remarkPlugins: [
|
|
// 添加 remark 插件
|
|
],
|
|
rehypePlugins: [
|
|
// 添加 rehype 插件
|
|
],
|
|
// 启用 MDX 表达式
|
|
optimize: true,
|
|
}),
|
|
react(), //
|
|
// sitemap(), // sitemap must be site has a domain
|
|
],
|
|
|
|
vite: {
|
|
plugins: [tailwindcss()],
|
|
define: {
|
|
basename: JSON.stringify(basename || ''),
|
|
},
|
|
server: {
|
|
port: 7008,
|
|
host: '0.0.0.0',
|
|
allowedHosts: true,
|
|
proxy,
|
|
},
|
|
},
|
|
});
|