1
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import react from "@vitejs/plugin-react-swc";
|
||||
import { visualizer } from "rollup-plugin-visualizer";
|
||||
import { defineConfig } from "vite";
|
||||
import { createHtmlPlugin } from 'vite-plugin-html';
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||
import svgr from "vite-plugin-svgr";
|
||||
const apiRoutes = ["^/api/", "/health"];
|
||||
import path from "path";
|
||||
// Use environment variable to determine the target.
|
||||
// const target = process.env.VITE_PROXY_TARGET || "http://localhost:7860";
|
||||
const target = process.env.VITE_PROXY_TARGET || "http://npcall.ai:3003";
|
||||
// const target = process.env.VITE_PROXY_TARGET || "http://172.30.40.241:7866";
|
||||
// const target = process.env.VITE_PROXY_TARGET || "http://npcall.ai:3101";
|
||||
const target = process.env.VITE_PROXY_TARGET || "http://dev.npcall.ai:3201";
|
||||
|
||||
const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
|
||||
proxyObj[route] = {
|
||||
@@ -27,8 +28,11 @@ const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
|
||||
return proxyObj;
|
||||
}, {});
|
||||
|
||||
const app_env = { BASE_URL: '' }
|
||||
|
||||
export default defineConfig(() => {
|
||||
return {
|
||||
base: app_env.BASE_URL || '/',
|
||||
build: {
|
||||
outDir: "build",
|
||||
rollupOptions: {
|
||||
@@ -50,6 +54,14 @@ export default defineConfig(() => {
|
||||
plugins: [
|
||||
react(),
|
||||
svgr(),
|
||||
createHtmlPlugin({
|
||||
minify: true,
|
||||
inject: {
|
||||
data: {
|
||||
aceScriptSrc: `<script src="${process.env.NODE_ENV === 'production' ? app_env.BASE_URL : ''}/node_modules/ace-builds/src-min-noconflict/ace.js" type="text/javascript"></script>`,
|
||||
},
|
||||
},
|
||||
}),
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
{
|
||||
@@ -73,6 +85,9 @@ export default defineConfig(() => {
|
||||
// open: true,
|
||||
// })
|
||||
],
|
||||
define: {
|
||||
__APP_ENV__: JSON.stringify(app_env)
|
||||
},
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 3001,
|
||||
|
||||
Reference in New Issue
Block a user