From 96bd5f180389dcb234982183c531e0e98e6cbc82 Mon Sep 17 00:00:00 2001 From: Quentin G Date: Mon, 15 Apr 2024 12:12:59 +0200 Subject: [PATCH] feat: add sourcemap generation for front (#4949) This PR changes the vite config to enable the generation of sourcemaps with the help of an Env. It also adds a new script to run the build with the said env as well as more memory (the dafault 2go leads to an OOM) --- packages/twenty-front/package.json | 1 + packages/twenty-front/vite.config.ts | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.json index a35903560..3b0195a0c 100644 --- a/packages/twenty-front/package.json +++ b/packages/twenty-front/package.json @@ -8,6 +8,7 @@ "start": "npx vite --host", "start:clean": "yarn start --force", "build": "yarn tsc && npx vite build && yarn build:inject-runtime-env", + "build:sourcemaps": "VITE_BUILD_SOURCEMAP=true NODE_OPTIONS=--max-old-space-size=3000 yarn build", "build:inject-runtime-env": "sh ./scripts/inject-runtime-env.sh", "tsc": "npx tsc --project tsconfig.app.json", "tsc:ci": "yarn tsc --project tsconfig.json", diff --git a/packages/twenty-front/vite.config.ts b/packages/twenty-front/vite.config.ts index cdfcd2cc7..0c9f5b383 100644 --- a/packages/twenty-front/vite.config.ts +++ b/packages/twenty-front/vite.config.ts @@ -13,7 +13,7 @@ export default defineConfig(({ command, mode }) => { /* Using explicit env variables, there is no need to expose all of them (security). */ - const { REACT_APP_SERVER_BASE_URL, SENTRY_RELEASE, ENVIRONMENT } = env; + const { REACT_APP_SERVER_BASE_URL, VITE_BUILD_SOURCEMAP } = env; const isBuildCommand = command === 'build'; @@ -51,6 +51,7 @@ export default defineConfig(({ command, mode }) => { build: { outDir: 'build', + sourcemap: VITE_BUILD_SOURCEMAP === 'true', }, envPrefix: 'REACT_APP_', @@ -58,8 +59,6 @@ export default defineConfig(({ command, mode }) => { define: { 'process.env': { REACT_APP_SERVER_BASE_URL, - SENTRY_RELEASE, - ENVIRONMENT, }, }, };