Open igorrKurr opened 8 years ago
+1 please make this compatible with react(server-side-rendering) and webpack. I think wrapping entire codes with
function(window) {
// codes here
}(typeof window === 'object' ? window : this)
will suffice
Apologies for the bump, but IMO this is super important. Plenty of iso environments these days with React + Angular that this currently kills.
Until #48 is merged, you can use sheerun/filepicker-js#isomorphic
as npm dependency for isomorphic apps (or when testing with mocha)
Additionally this is causing our tests to fail; using jsdom-global
to simulate the DOM in test environments, we find that this code causes a failure:
require("jsdom-global")();
require("filepicker-js");
ReferenceError: filepicker is not defined
at Object.<anonymous> (/node_modules/filepicker-js/dist/filepicker.js:65:1)
The reason is that it is attaching itself to window
automatically (that fails if we don't use jsdom-global
), and then even with JSDOM window
isn't a global in Node so it doesn't see it globally.
This relates to #56
Hey! I've tried to use it with react isomorphic tools, and got that error. Is it possible to mock
window
somehow? Or make it agnostic?