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
Environment for the intersection of browser and node #3599
Comments
Thanks for the issue! We get a lot of issues, so this message is automatically posted to each one to help you check that you've included all of the information we need to help you. Reporting a bug? Please be sure to include:
Requesting a new rule? Please be sure to include:
Requesting a feature? Please be sure to include:
Including this information in your issue helps us to triage it and get you a response as quickly as possible. Thanks! |
I'm having trouble understanding what you're asking. If a file is going to be used in both the browser and the server, why don't you enable both environments? |
If I'm reading this correctly, the goal is to allow only the globals that are common to both to guarantee that the code can run safely in either environment. Is that it? |
@btmills correct. Code needs to work correctly in both environments, so they should only have access to the things that are common to both. |
We achieved this by disabling both and hand picking the few globals that May be we can add a "isomorphic" (or please a better name) environment to On Mon, Aug 31, 2015, 06:02 Eli White notifications@github.com wrote:
|
Recently, I read this article: http://www.2ality.com/2015/08/isomorphic-javascript.html Is |
👍 for universal. That said it may sound a bit too broad since this is mostly |
I'm still not sure I understand why we need this. What are we really taking about here? |
The intersection between is currently:
|
Hmm okay. @sindresorhus do you think it's worth adding this to |
👍 |
@sindresorhus any suggestions for the name? Are you okay with |
|
I think |
Agreed that |
To me, |
|
Okay, gonna go with |
@sindresorhus - Sent sindresorhus/globals#50. Hope you don't hate us for the name. |
This was added in |
The addition of the new commonjs environment was very useful to not allow node only globals in our browser specific code. However, we have a folder of files that are used on both the server and client.
It doesn't make sense to provide the env key
browser
since in node you don't have access to HTMLElement (as an example), and in the browser you don't have access to the node globals.However, when you are in both environments you have access to the intersection of the two such as the setInterval family of functions.
How can we handle this case?
The text was updated successfully, but these errors were encountered: