reactackle icon indicating copy to clipboard operation
reactackle copied to clipboard

ReferenceError: window is not defined

Open gsoec opened this issue 7 years ago • 2 comments

This error occur on SSR

[1] /app/node_modules/reactackle-autoposition/dist/AutoPosition.js:125
[1]   parent: window,
[1]           ^
[1] 
[1] ReferenceError: window is not defined
[1]     at Object.<anonymous> (/app/node_modules/reactackle-autoposition/dist/AutoPosition.js:125:11)
[1]     at Module._compile (module.js:624:30)
[1]     at Object.Module._extensions..js (module.js:635:10)
[1]     at Module.load (module.js:545:32)
[1]     at tryModuleLoad (module.js:508:12)
[1]     at Function.Module._load (module.js:500:3)
[1]     at Module.require (module.js:568:17)
[1]     at require (internal/module.js:11:18)
[1]     at Object.<anonymous> (/app/node_modules/reactackle-autoposition/dist/index.js:8:21)
[1]     at Module._compile (module.js:624:30)

gsoec avatar Jun 06 '18 18:06 gsoec

@gsoec Currently, Reactackle is not adapted for SSR rendering. Here is the workaround:

let AutoPosition;
if (typeof window !== "undefined") {
  SelectBox = require("reactackle-selectbox").SelectBox;
}

#100

VNadygin avatar Jun 07 '18 09:06 VNadygin

@gsoec You are welcome to contribute in https://github.com/bcrumbs/reactackle/issues/100. SSR is important thing, but we just haven't enough time for it now.

nik-paushkin avatar Jun 07 '18 15:06 nik-paushkin