Skip to content

Commit

Permalink
Merge pull request #236 from RexWzh/main
Browse files Browse the repository at this point in the history
Fix Bug with Environment Variables for Ports
  • Loading branch information
joneugster authored Jun 4, 2024
2 parents 4ed0753 + 2a14f48 commit b091ec5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import react from '@vitejs/plugin-react-swc'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import svgr from "vite-plugin-svgr"

const backendPort = process.env.PORT || 8080;
const clientPort = process.env.CLIENT_PORT || 3000;

// https://vitejs.dev/config/
export default defineConfig({
//root: 'client/src',
Expand Down Expand Up @@ -32,20 +35,20 @@ export default defineConfig({
exclude: ['games']
},
server: {
port: 3000,
port: Number(clientPort),
proxy: {
'/websocket': {
target: 'ws://localhost:8080',
target: `ws://localhost:${backendPort}`,
ws: true
},
'/import': {
target: 'http://localhost:8080',
target: `http://localhost:${backendPort}`,
},
'/data': {
target: 'http://localhost:8080',
target: `http://localhost:${backendPort}`,
},
'/i18n': {
target: 'http://localhost:8080',
target: `http://localhost:${backendPort}`,
},
}
},
Expand Down

0 comments on commit b091ec5

Please sign in to comment.