From 2b89273241ddfed023ecd5b1290a341c769fdcdd Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Fri, 14 Mar 2025 14:38:46 +0100 Subject: [PATCH] Fix API playground not loading (#10891) The @scalar package we use to offer a REST api playground is quite heavy (3k files compared to the 15k existing) and is not pre-build in the npm package, which is not unusual. This is increasing the memory need during vite build. I'm increasing the RAM available for vite build. Long term I recommend using a CDN here as this is not really a React component so we won't benefit from any reactivity anyway. Exaclty like we have done for FrontApp support chat integration image --- packages/twenty-front/package.json | 4 ++-- packages/twenty-front/vite.config.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.json index c88a46e28..22eb520cb 100644 --- a/packages/twenty-front/package.json +++ b/packages/twenty-front/package.json @@ -4,8 +4,8 @@ "private": true, "type": "module", "scripts": { - "build": "VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=4000 npx vite build && sh ./scripts/inject-runtime-env.sh", - "build:sourcemaps": "VITE_BUILD_SOURCEMAP=true VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=6000 npx vite build && sh ./scripts/inject-runtime-env.sh", + "build": "VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=4500 npx vite build && sh ./scripts/inject-runtime-env.sh", + "build:sourcemaps": "VITE_BUILD_SOURCEMAP=true VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=7000 npx vite build && sh ./scripts/inject-runtime-env.sh", "start:prod": "NODE_ENV=production npx vite --host", "tsup": "npx tsup" }, diff --git a/packages/twenty-front/vite.config.ts b/packages/twenty-front/vite.config.ts index 011202055..e694870ea 100644 --- a/packages/twenty-front/vite.config.ts +++ b/packages/twenty-front/vite.config.ts @@ -146,7 +146,15 @@ export default defineConfig(({ command, mode }) => { outDir: 'build', sourcemap: VITE_BUILD_SOURCEMAP === 'true', rollupOptions: { - external: ['@scalar/api-reference-react'], + output: { + manualChunks: (id: string) => { + if (id.includes('@scalar')) { + return 'scalar'; + } + + return null; + }, + }, }, },