diff --git a/packages/twenty-front/.env.example b/packages/twenty-front/.env.example index 3fccb201c4b9..345d0fb92ad7 100644 --- a/packages/twenty-front/.env.example +++ b/packages/twenty-front/.env.example @@ -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 \ No newline at end of file diff --git a/packages/twenty-front/vite.config.ts b/packages/twenty-front/vite.config.ts index a3a7af054b68..4239d483e6f1 100644 --- a/packages/twenty-front/vite.config.ts +++ b/packages/twenty-front/vite.config.ts @@ -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'; @@ -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 @@ -61,7 +65,7 @@ export default defineConfig(({ command, mode }) => { cacheDir: '../../node_modules/.vite/packages/twenty-front', server: { - port: 3001, + port, host: 'localhost', fs: { allow: [