Here's the deal: with webpack you can provide environment variables (via DefinePlugin
or EnvironmentPlugin
) so they can be consumed by the code like process.env.MY_VAR
. It works that they'll be inlined with real values at the build time.
But I'm having trouble trying to consume them in Reason. Bucklescript has Node.Process
module, but when you use Node.Process##env
it is transpiled to
var process = require("process")
var myVar = process.env["MY_VAR"]
So it's not gonna be picked up by webpack and inlined. So what can I use to achieve that it will be traspiled to var myVar = process.env.MY_VAR
?