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
This commit is contained in:
David Lechner
2021-12-27 12:38:51 -06:00
parent aea52d4ab6
commit 5f3271aaea
+1 -1
View File
@@ -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)] || '',
);
},
},