We had some rollup config to replace process.env.NODE_ENV with their actual values, but incorrectly set to do it as a direct replacement.
That meant that if NODE_ENV=production, it would replace process.env.NODE_ENV by the literal value production, which is then treated as a variable, causing a ReferenceError: production is not defined error.
We had some rollup config to replace
process.env.NODE_ENV
with their actual values, but incorrectly set to do it as a direct replacement.That meant that if
NODE_ENV=production
, it would replaceprocess.env.NODE_ENV
by the literal valueproduction
, which is then treated as a variable, causing aReferenceError: production is not defined
error.This PR fixes that by JSON-encoding the value of
process.env.NODE_ENV
before replacing it in code, as seen in the docs https://www.npmjs.com/package/@rollup/plugin-replace