You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/Users/ubarbaxor/code/imagery-watcher/node_modules/libcoverage/src/parse.js:12
if (typeof window.DOMParser != "undefined") {
^
ReferenceError: window is not defined
at Object.<anonymous> (/Users/ubarbaxor/code/imagery-watcher/node_modules/libcoverage/src/parse.js:12:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/ubarbaxor/code/imagery-watcher/src/index.js:98:21)
at Module._compile (module.js:624:30)
I've been checking in src/parse.js:12 there's something in the taste of :
if (typeof window.DOMParser != "undefined") { ... }
else if (typeof window.ActiveXObject != "undefined" &&
new window.ActiveXObject("Microsoft.XMLDOM")) { ... }
This causes ReferenceError: window is not defined in node.js.
A simple solution would be to wrap the whole block in something in the taste of :
if (typeof window != "undefined") { ... }
I'm not sure this lib is meant to be usable in node, currently trying it to integrate DigitalGlobe API, so I had to fork and fix this myself.
I'm willing to issue a PR in case this issue can be addressed.
The text was updated successfully, but these errors were encountered:
Thanks for raising this issue and providing an PR! In fact, libcoverage.js was initially conceived before node.js was actually at the point of popularity it is today, so it was considered "browser-only". Much has changed since that, and I'm very much in favor of supporting node.js as-well.
Unfortunately, as demonstrated by the issue you raised, XML handling is rather different in the browser than with node and more work is required to be really on par with the browsers capabilities (I'm talking about DOM parsing and xPath expressions especially).
This can be done step by step, so making the request part of libcoverage.js work under node is already a great improvement!
ReferenceError: window is not defined
in Node.jsI've been checking in src/parse.js:12 there's something in the taste of :
This causes
ReferenceError: window is not defined
in node.js.A simple solution would be to wrap the whole block in something in the taste of :
I'm not sure this lib is meant to be usable in node, currently trying it to integrate DigitalGlobe API, so I had to fork and fix this myself.
I'm willing to issue a PR in case this issue can be addressed.
The text was updated successfully, but these errors were encountered: