In #55, we decided to introduce first-class Oxygen.env support for Hydrogen. This was designed around the intent that Oxygen would inject this in its Web runtime.
However, we've since pivoted away from that plan, and Oxygen is no longer going to do that. This means Hydrogen is responsible for injecting this variable on its own.
This is confusing for a number of reasons, primarily because it means Hydrogen builds a unique affordance for runtime environment variables that doesn't exist on any platform — literally.
Meanwhile, Vite now supports process.env in SSR runtimes (it previously did not).
I propose that we adopt process.env for runtime environment variables in Hydrogen.
This means populating a process.env in our platforms/worker.ts file. It also means updating all instances of Oxygen.env with process.env.
I think this better matches the behavior in other frameworks deployed to Workers runtimes as well.
Drawbacks
- Does the presence of
process trick any 3p libs into thinking we are running in Node, thus causing compatibility issues?
- Is it going to be confusing that other
process properties are not available?
In #55, we decided to introduce first-class
Oxygen.envsupport for Hydrogen. This was designed around the intent that Oxygen would inject this in its Web runtime.However, we've since pivoted away from that plan, and Oxygen is no longer going to do that. This means Hydrogen is responsible for injecting this variable on its own.
This is confusing for a number of reasons, primarily because it means Hydrogen builds a unique affordance for runtime environment variables that doesn't exist on any platform — literally.
Meanwhile, Vite now supports
process.envin SSR runtimes (it previously did not).I propose that we adopt
process.envfor runtime environment variables in Hydrogen.This means populating a
process.envin ourplatforms/worker.tsfile. It also means updating all instances ofOxygen.envwithprocess.env.I think this better matches the behavior in other frameworks deployed to Workers runtimes as well.
Drawbacks
processtrick any 3p libs into thinking we are running in Node, thus causing compatibility issues?processproperties are not available?