Be able to specify front port (#8382)

- Added REACT_APP_PORT in front .env
- Use value if specified otherwise 3001 by default

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Lucas Bordeau 2024-11-07 18:11:51 +01:00 committed by GitHub
parent 6264d509bd
commit 83f3963bfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,7 @@ REACT_APP_SERVER_BASE_URL=http://localhost:3000
GENERATE_SOURCEMAP=false GENERATE_SOURCEMAP=false
# ———————— Optional ———————— # ———————— Optional ————————
# REACT_APP_PORT=3001
# CHROMATIC_PROJECT_TOKEN= # CHROMATIC_PROJECT_TOKEN=
# VITE_DISABLE_TYPESCRIPT_CHECKER=true # VITE_DISABLE_TYPESCRIPT_CHECKER=true
# VITE_DISABLE_ESLINT_CHECKER=true # VITE_DISABLE_ESLINT_CHECKER=true

View File

@ -1,4 +1,5 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
import { isNonEmptyString } from '@sniptt/guards';
import react from '@vitejs/plugin-react-swc'; import react from '@vitejs/plugin-react-swc';
import wyw from '@wyw-in-js/vite'; import wyw from '@wyw-in-js/vite';
import path from 'path'; import path from 'path';
@ -17,8 +18,11 @@ export default defineConfig(({ command, mode }) => {
VITE_BUILD_SOURCEMAP, VITE_BUILD_SOURCEMAP,
VITE_DISABLE_TYPESCRIPT_CHECKER, VITE_DISABLE_TYPESCRIPT_CHECKER,
VITE_DISABLE_ESLINT_CHECKER, VITE_DISABLE_ESLINT_CHECKER,
REACT_APP_PORT
} = env; } = env;
const port = isNonEmptyString(REACT_APP_PORT) ? parseInt(REACT_APP_PORT) : 3001;
const isBuildCommand = command === 'build'; const isBuildCommand = command === 'build';
const tsConfigPath = isBuildCommand const tsConfigPath = isBuildCommand
@ -61,7 +65,7 @@ export default defineConfig(({ command, mode }) => {
cacheDir: '../../node_modules/.vite/packages/twenty-front', cacheDir: '../../node_modules/.vite/packages/twenty-front',
server: { server: {
port: 3001, port,
host: 'localhost', host: 'localhost',
fs: { fs: {
allow: [ allow: [