Skip to content

Commit

Permalink
Be able to specify front port (twentyhq#8382)
Browse files Browse the repository at this point in the history
- Added REACT_APP_PORT in front .env
- Use value if specified otherwise 3001 by default

---------

Co-authored-by: Charles Bochet <[email protected]>
  • Loading branch information
lucasbordeau and charlesBochet authored Nov 7, 2024
1 parent 6264d50 commit 83f3963
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/twenty-front/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ REACT_APP_SERVER_BASE_URL=http://localhost:3000
GENERATE_SOURCEMAP=false

# ———————— Optional ————————
# REACT_APP_PORT=3001
# CHROMATIC_PROJECT_TOKEN=
# VITE_DISABLE_TYPESCRIPT_CHECKER=true
# VITE_DISABLE_ESLINT_CHECKER=true
6 changes: 5 additions & 1 deletion packages/twenty-front/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-console */
import { isNonEmptyString } from '@sniptt/guards';
import react from '@vitejs/plugin-react-swc';
import wyw from '@wyw-in-js/vite';
import path from 'path';
Expand All @@ -17,8 +18,11 @@ export default defineConfig(({ command, mode }) => {
VITE_BUILD_SOURCEMAP,
VITE_DISABLE_TYPESCRIPT_CHECKER,
VITE_DISABLE_ESLINT_CHECKER,
REACT_APP_PORT
} = env;

const port = isNonEmptyString(REACT_APP_PORT) ? parseInt(REACT_APP_PORT) : 3001;

const isBuildCommand = command === 'build';

const tsConfigPath = isBuildCommand
Expand Down Expand Up @@ -61,7 +65,7 @@ export default defineConfig(({ command, mode }) => {
cacheDir: '../../node_modules/.vite/packages/twenty-front',

server: {
port: 3001,
port,
host: 'localhost',
fs: {
allow: [
Expand Down

0 comments on commit 83f3963

Please sign in to comment.