Is there a way to setup node environment when window global is present?
See original GitHub issueHi, so you are deciding between browser
or node
environment based on presence of window variable:
if (_window) {
setupBrowser();
} else {
setupNode();
}
where _window
is
'undefined' !== typeof window ? window : null
We have a window
global in node though and we would like to have the node
part with crypto.randomBytes
available. So we get rid of:
[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()
Is there any workaround for this?
Or are you willing to change the “decision” part for node to be more complex than just window
being undefined? (e.g. having a window.iAmStillNode
set to true
or something more complex)
Issue Analytics
- State:
- Created 8 years ago
- Reactions:8
- Comments:7 (1 by maintainers)
Top Results From Across the Web
node.js - How can I set NODE_ENV=production on Windows?
Just install it (globally), and run your npm script commands, it should automatically make them work. Save this answer. Show activity on this...
Read more >How to Set Up Windows for Node.js Development with NVM
Unzip the folder's contents and run nvm-setup.exe . You'll be prompted to agree with the project's terms of use (currently it's the MIT...
Read more >Working with Environment Variables in Node.js - Twilio
Environment variables are a great way to configure parts of your Node.js application. Learn how to work with them using helpful tools such ......
Read more >Node JS Environment Setup - Node.js installation - DigitalOcean
Choose Default values and click on “Install” Button. Open Node JS Platform Home in your Explorer. Here we can observe node.exe and npm....
Read more >Setting up a Node development environment - MDN Web Docs
In order to use Express you will first have to install Nodejs and the Node Package Manager (npm) on your operating system. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FWIW, I’m having this come through as a warning when running tests in Jest.
If someone wants to PR I can pull it in.
I’d rather
try { setupNode(); } catch (e) { setupBrowser() }
because depending onwindow.self
just sounds like we’re gonna land in trouble somehow somewhere.