From ce67005d661f90cc0519e8a7b00699192c86e3c5 Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Tue, 10 May 2022 17:18:20 +0530 Subject: [PATCH] feat: NODE_ENV is configured in the frontend --- frontend/Dockerfile | 3 +++ frontend/src/constants/env.ts | 2 ++ frontend/src/typings/environment.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 530d6acf5f..a727b49c71 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -12,6 +12,9 @@ WORKDIR /frontend # copy the package.json to install dependencies COPY package.json ./ +# configure node_env as production +ENV NODE_ENV=production + # Install the dependencies and make the folder RUN yarn install diff --git a/frontend/src/constants/env.ts b/frontend/src/constants/env.ts index 2c5230dfcc..e0bca1d6fd 100644 --- a/frontend/src/constants/env.ts +++ b/frontend/src/constants/env.ts @@ -3,4 +3,6 @@ export const ENVIRONMENT = { process?.env?.FRONTEND_API_ENDPOINT || process?.env?.GITPOD_WORKSPACE_URL?.replace('://', '://8080-') || '', + isProduction: process?.env?.NODE_ENV === 'production', + NODE_ENV: process?.env?.NODE_ENV, }; diff --git a/frontend/src/typings/environment.ts b/frontend/src/typings/environment.ts index c77832ce43..6293dd8ada 100644 --- a/frontend/src/typings/environment.ts +++ b/frontend/src/typings/environment.ts @@ -3,6 +3,7 @@ declare global { namespace NodeJS { interface ProcessEnv { FRONTEND_API_ENDPOINT: string | undefined; + NODE_ENV: 'development' | 'production' | 'test'; } } }