question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change the way detect nodejs environment

See original GitHub issue

Can we use

  var isNodeEnv = function isNodeEnv() {
    return typeof global != 'undefined';
  };

instead of

  var isNodeEnv = function isNodeEnv() {
    return typeof window === 'undefined' || typeof document === 'undefined';
  };

To make angular universal works with some libraries, I’ve to provide a shim for window and document objects. If we use global object which is node-specific, we can address the issues better.

Thanks for the fantastic library.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
limontecommented, Mar 24, 2020

Reopening the issue because unfortunately, I had to undo this change, see details in #1927

1reaction
zenflowcommented, Mar 25, 2020

Basically, I think the error “SweetAlert2 requires document to initialize” was correct in the first place. Just preventing that error from happening will not change the fact that “SweetAlert2 requires document to initialize”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node JS, detect production environment - Stack Overflow
Node JS, detect production environment · I use local config file, that not under git and extends main config. So any local key...
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 >
Using Environment Variables in Node.js for App Configuration ...
Environment variables are considered the best way to configure applications, with the main benefits being: Secrets such as database credentials ...
Read more >
NVM, the Easiest Way to Switch Node.js Environments on ...
Then type CTRL + X from a Mac, Y to save the changes, and Enter and you should be back where you started...
Read more >
Debug Node.js Apps using Visual Studio Code
js debugger automatically restarts after the debug session has ended. This feature is useful if you use nodemon to restart Node.js on file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found