From 1b34dd5cd892ac837c4ade3593e06a7ce0e40e7d Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Sun, 1 Sep 2024 16:49:17 -0500 Subject: [PATCH] fix(scripts): make print:crops work --- src/config.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/config.js b/src/config.js index ae612149..482f8303 100644 --- a/src/config.js +++ b/src/config.js @@ -24,15 +24,18 @@ export const endpoints = { * FOREST?: boolean * }} */ -export const features = Object.keys(import.meta.env).reduce((acc, key) => { - const matches = key.match(/VITE_ENABLE_(.*)/) +export const features = Object.keys(import.meta.env ?? {}).reduce( + (acc, key) => { + const matches = key.match(/VITE_ENABLE_(.*)/) - if (matches) { - acc[matches[1]] = true - } + if (matches) { + acc[matches[1]] = true + } - return acc -}, {}) + return acc + }, + {} +) // Use optional chaining here because window.location will not be defined when // this is running in a Node.js context.