-
Notifications
You must be signed in to change notification settings - Fork 13
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
Standard access to runtime variables #7
Comments
What are the reasons |
@blittle CJS and ESM are both first-class module systems in node for the foreseeable future, and most of npm (and thus most of the world's public package code) is CJS by a very very large margin, so I'd argue that anything that doesn't maintain CJS compatibility is making a pretty large misstep. |
Misstep or not, the idea with the common minimum spec is to document the common already standardized api surface area for the runtimes. This is something we likely should discuss in its own workstream.
Also consider that a goal here is to focus on alignment with the Web ecosystem ... specifically, what approach could work for browsers also. For that, a proposal for something like a |
@jasnell "env vars" as a concept simply don't make any sense in a web browser, so i'm not sure what approach would work for browsers. "env" is "environment", and in the web there's only one environment, and no consistent way for users to invoke it with different "environmental input". This seems like a new API, that should first be proposed to WHATWG. |
So we should now working on a new whatwg api first? |
@blittle I think the ability to read some external meta data is very important, but a "runtime variable" is an ambiguous concept in a JS runtime context. Normally, runtime vars and their properties are OS-specific, while JS runtimes (in general) don't have the concept of a "host operating system". If we think more about env vars, multiple issues pop up, like:
Could we, instead of "runtime vars", use a more generic term like "external metadata" and think if we can have a standardised API for it? It should of course be able to cover the runtime vars use case :) |
@maxshirshin I agree with that, and that's kinda the point of the |
It makes a ton of sense to devise some common API around this for both ESM and non-ESM environments. This should be its own workstream, however. |
Should this be closed in favor of wintercg/environment-metadata#1 as the workstream has been established? |
Should there be a standard global location to access runtime variables?
Options:
process.env
import.meta.env
The text was updated successfully, but these errors were encountered: