-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider dropping Oxygen.env
and use process.env
instead
#1226
Comments
Would it in conflict with this? export async function isStreamingSupported() {
return Boolean(globalThis.Oxygen?.env?.HYDROGEN_ENABLE_WORKER_STREAMING);
} which is currently preventing streaming from happening on any platform that is not Oxygen. |
(I think we can remove that — checking to see if streaming is supported natively right now) We also consider a Node.js streamable by default. |
Love this idea! Something else to consider: many packages key off 'process.env.NODE_ENV === "development"' in order to expose local dev warnings. If NODE_ENV is not set, you may even run into !== "production" checks which could leak dev warnings in prod environments. Might there be other NODE_ENV vars that represent system architecture attributes where you could differentiate? How does Cloudflare handle this in workers? Have they encountered any issues with library compat? |
Now tracking in #1879 |
Duplicate of #1879 |
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 ourplatforms/worker.ts
file. It also means updating all instances ofOxygen.env
withprocess.env
.I think this better matches the behavior in other frameworks deployed to Workers runtimes as well.
Drawbacks
process
trick any 3p libs into thinking we are running in Node, thus causing compatibility issues?process
properties are not available?The text was updated successfully, but these errors were encountered: