generated from template/astro-simple-template
64 lines
1.6 KiB
JavaScript
64 lines
1.6 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';
|
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
|
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}`;
|
|
const vad = viteStaticCopy({
|
|
targets: [
|
|
{
|
|
src: 'node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js',
|
|
dest: './public/',
|
|
},
|
|
{
|
|
src: 'node_modules/@ricky0123/vad-web/dist/silero_vad_v5.onnx',
|
|
dest: './public/',
|
|
},
|
|
{
|
|
src: 'node_modules/@ricky0123/vad-web/dist/silero_vad_legacy.onnx',
|
|
dest: './public/',
|
|
},
|
|
{
|
|
src: 'node_modules/onnxruntime-web/dist/*.wasm',
|
|
dest: './public/',
|
|
},
|
|
{
|
|
src: 'node_modules/onnxruntime-web/dist/*.mjs',
|
|
dest: './public/',
|
|
},
|
|
],
|
|
});
|
|
export default defineConfig({
|
|
base: basename,
|
|
integrations: [
|
|
mdx(),
|
|
react(), //
|
|
// sitemap(), // sitemap must be site has a domain
|
|
],
|
|
|
|
vite: {
|
|
plugins: [tailwindcss(), vad],
|
|
define: {
|
|
basename: JSON.stringify(basename || ''),
|
|
},
|
|
server: {
|
|
port: 7008,
|
|
host: '0.0.0.0',
|
|
allowedHosts: true,
|
|
proxy,
|
|
},
|
|
},
|
|
});
|