process.envobject like so:
process.env.YOUR_KEY_HERE. But your user's browser won't have access to a
processobject. How will we handle this?
EnvironmentPluginto do this. It takes an array of environment variable names to allow in your application. Then all instances of
process.env.YOUR_KEY_HEREwill be replaced with the value in your environment.
mix.envmethod that passes through to
NODE_ENVis a very common environment variable used by many libraries to output additional debugging information or to enable optimizations. Since Elixir already knows what environment you are building for, this value is defaulted for you. If you desire to override that value, just define
NODE_ENVin your environment and it will take precendence.