From 736347d37cd1c6cd63ded6a1daafa3b6431ebee2 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 18 Feb 2022 21:30:41 -0800 Subject: [PATCH] Don't destructure process.env. --- next.config.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/next.config.js b/next.config.js index 8387e9ac..71cb9b20 100644 --- a/next.config.js +++ b/next.config.js @@ -1,16 +1,16 @@ require('dotenv').config(); const pkg = require('./package.json'); -const { BASE_PATH, FORCE_SSL, DISABLE_LOGIN, TRACKER_SCRIPT_NAME } = process.env; +const scriptName = process.env.TRACKER_SCRIPT_NAME; module.exports = { env: { VERSION: pkg.version, - FORCE_SSL: Boolean(FORCE_SSL), - DISABLE_LOGIN: Boolean(DISABLE_LOGIN), - TRACKER_SCRIPT_NAME, + FORCE_SSL: Boolean(process.env.FORCE_SSL), + DISABLE_LOGIN: Boolean(process.env.DISABLE_LOGIN), + TRACKER_SCRIPT_NAME: scriptName, }, - basePath: BASE_PATH, + basePath: process.env.BASE_PATH, eslint: { ignoreDuringBuilds: true, }, @@ -24,14 +24,12 @@ module.exports = { return config; }, async rewrites() { - return TRACKER_SCRIPT_NAME - ? [{ source: `/${TRACKER_SCRIPT_NAME}.js`, destination: '/umami.js' }] - : []; + return scriptName ? [{ source: `/${scriptName}.js`, destination: '/umami.js' }] : []; }, async headers() { return [ { - source: `/${TRACKER_SCRIPT_NAME || 'umami'}.js`, + source: `/${scriptName || 'umami'}.js`, headers: [ { key: 'Cache-Control',