Skip to content

Commit

Permalink
Do not assume 'global' exists in non-node environments when using bui…
Browse files Browse the repository at this point in the history
…ld tools. Fixes #251
  • Loading branch information
jsantell committed Jun 1, 2017
1 parent 52827e9 commit c80e494
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/node-entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// if running in node and there is a window mock available,
// globalize its members where needed
if (global && global.window) {
// This is the entry point if requiring/importing via node, or
// a build tool that uses package.json entry (like browserify, webpack).
// If running in node with a window mock available, globalize it's members
// if needed. Otherwise, just continue to `./main`
if (typeof global !== 'undefined' && global.window) {
global.document = global.window.document;
global.navigator = global.window.navigator;
}
Expand Down

0 comments on commit c80e494

Please sign in to comment.