From c17e1375b3dc3ba96d7fb75e4ca867c421f43647 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 29 Jun 2023 16:27:28 -0400 Subject: [PATCH] fix dev env caching --- package.json | 2 +- src/server/middleware.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index cf2d78fa..04badaec 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "analyze": "webpack --mode=none", "prebuild:dev": "yarn clean && node generate_translations.js", - "build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development", + "build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) NODE_ENV=development --mode=development", "prebuild:prod": "yarn clean && node generate_translations.js", "build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production", "clean": "yarn run rimraf dist", diff --git a/src/server/middleware.ts b/src/server/middleware.ts index 84c568d1..b7ed2b58 100644 --- a/src/server/middleware.ts +++ b/src/server/middleware.ts @@ -27,6 +27,11 @@ export function setCacheControl( res: Response, next: NextFunction ) { + // Avoid setting Cache-Control in development + if (process.env.NODE_ENV === "development") { + return next(); + } + const user = UserService.Instance; let caching: string;