From 5f3271aaea9e780563dbc6d41c09bac2f58ceb1c Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 22 Dec 2021 12:03:06 -0600 Subject: [PATCH] craco: fix env substitution for undefined variable When an environment variable is not defined, `process.env` returns `undefined` which was used literally as text. Fix by using an empty string if `process.env` returns something falsy. Fixes: https://github.com/pybricks/support/issues/560 --- craco.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/craco.config.js b/craco.config.js index b92fc342..e4a5eac8 100644 --- a/craco.config.js +++ b/craco.config.js @@ -198,7 +198,7 @@ module.exports = { .toString() .replace( /%\w+%/g, - (m) => process.env[m.slice(1, m.length - 1)], + (m) => process.env[m.slice(1, m.length - 1)] || '', ); }, },