Skip to content

Commit

Permalink
Merge pull request #2886 from elizaOS/tcm-client-env
Browse files Browse the repository at this point in the history
fix: client server port
  • Loading branch information
tcm390 authored Jan 28, 2025
2 parents 46fcb26 + 65d6e96 commit 9f8106c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 25 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ PGLITE_DATA_DIR= #../pgLite/ if selecting a directory --- or memory:// if

# Eliza Port Config
SERVER_PORT=3000
VITE_SERVER_PORT=${SERVER_PORT}

# Supabase Configuration
SUPABASE_URL=
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { UUID, Character } from "@elizaos/core";

const BASE_URL = `http://localhost:${import.meta.env.VITE_SERVER_PORT ?? 3000}`;
const BASE_URL = `http://localhost:${import.meta.env.VITE_SERVER_PORT}`;

const fetcher = async ({
url,
Expand Down
55 changes: 32 additions & 23 deletions client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
import { defineConfig } from "vite";
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
import viteCompression from "vite-plugin-compression";
import path from "path";

// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
viteCompression({
algorithm: "brotliCompress",
ext: ".br",
threshold: 1024,
}),
],
clearScreen: false,
envDir: path.resolve(__dirname, ".."),
build: {
outDir: "dist",
minify: true,
cssMinify: true,
sourcemap: false,
cssCodeSplit: true,
},
resolve: {
alias: {
"@": "/src",
export default defineConfig(({ mode }) => {
const envDir = path.resolve(__dirname, "..");
const env = loadEnv(mode, envDir, "");
return {
plugins: [
react(),
viteCompression({
algorithm: "brotliCompress",
ext: ".br",
threshold: 1024,
}),
],
clearScreen: false,
envDir,
define: {
"import.meta.env.VITE_SERVER_PORT": JSON.stringify(
env.SERVER_PORT || "3000"
),
},
},
build: {
outDir: "dist",
minify: true,
cssMinify: true,
sourcemap: false,
cssCodeSplit: true,
},
resolve: {
alias: {
"@": "/src",
},
},
};
});

0 comments on commit 9f8106c

Please sign in to comment.