From b71c2d6849d9940d0cffeb2ed1d80243569f70de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20G=C3=B6rg=C3=BCl=C3=BC?= Date: Sun, 17 Mar 2024 02:13:17 +0300 Subject: [PATCH] refactor: nuxt.config.js --- nuxt.config.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index 11452ebc..33c59ee4 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -2,13 +2,11 @@ import fs from "fs"; import path from "path"; import tr from "vuetify/es5/locale/tr"; -let cspNonce = "development-mode"; const cspNonceTxtPath = path.join(__dirname, "csp-nonce.txt"); -const cspNonceTxt = fs.existsSync(cspNonceTxtPath); -if (cspNonceTxt) { - // create-csp-nonce-txt.js - cspNonce = fs.readFileSync(cspNonceTxtPath, { encoding: "utf-8" }); -} +const isCspNonceTxtExists = fs.existsSync(cspNonceTxtPath); +const cspNonce = isCspNonceTxtExists ? + fs.readFileSync(cspNonceTxtPath, { encoding: "utf-8" }) : + "development-mode"; export default { target: "static",