hypothesis / lms

LTI app for integrating with learning management systems
BSD 2-Clause "Simplified" License
46 stars 14 forks source link

Make sure process.env.NODE_ENV is stringified #6471

Closed acelaya closed 2 months ago

acelaya commented 2 months ago

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.

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