Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window is not defined #3994

Closed
AleksaButterfly opened this issue Mar 31, 2020 · 3 comments
Closed

Window is not defined #3994

AleksaButterfly opened this issue Mar 31, 2020 · 3 comments
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet

Comments

@AleksaButterfly
Copy link

Hello!

I have a create-react-app application and I wanted to use amazing react-select. It works while its on my localhost but when I push it to herokuapp online (production mode) I get the error that the window isnt defiend.

/app/build/static/node_modules/react-select/dist/Select-9fdb8cd0.browser.esm.js:495 2020-03-31T13:00:00.222254+00:00 app[web.1]: return 'ontouchstart' in window || navigator.maxTouchPoints; 2020-03-31T13:00:00.222254+00:00 app[web.1]: ^ 2020-03-31T13:00:00.222315+00:00 app[web.1]: ReferenceError: window is not defined 2020-03-31T13:00:00.222316+00:00 app[web.1]: at Object.<anonymous> (/app/build/static/node_modules/react-select/dist/Select-9fdb8cd0.browser.esm.js:495:3) 2020-03-31T13:00:00.222316+00:00 app[web.1]: at n (/app/build/static/webpack/bootstrap:9:5) 2020-03-31T13:00:00.222317+00:00 app[web.1]: at Object.<anonymous> (/app/build/static/js/main.34f02a46.js:1:444330) 2020-03-31T13:00:00.222317+00:00 app[web.1]: at n (/app/build/static/webpack/bootstrap:9:5) 2020-03-31T13:00:00.222318+00:00 app[web.1]: at Object.<anonymous> (/app/build/static/js/main.34f02a46.js:1:426715) 2020-03-31T13:00:00.222318+00:00 app[web.1]: at n (/app/build/static/webpack/bootstrap:9:5) 2020-03-31T13:00:00.222319+00:00 app[web.1]: at Module.compose (/app/build/static/js/store.js:19:9) 2020-03-31T13:00:00.222319+00:00 app[web.1]: at n (/app/build/static/webpack/bootstrap:9:5) 2020-03-31T13:00:00.222319+00:00 app[web.1]: at Object.<anonymous> (/app/build/static/js/main.34f02a46.js:1:1830012) 2020-03-31T13:00:00.222320+00:00 app[web.1]: at n (/app/build/static/webpack/bootstrap:9:5) 2020-03-31T13:00:00.240453+00:00 app[web.1]: npm ERR! code ELIFECYCLE 2020-03-31T13:00:00.240812+00:00 app[web.1]: npm ERR! errno 1 2020-03-31T13:00:00.242218+00:00 app[web.1]: npm ERR! app@4.4.0 start:node --icu-data-dir=node_modules/full-icu server/index.js 2020-03-31T13:00:00.242364+00:00 app[web.1]: npm ERR! Exit status 1 2020-03-31T13:00:00.242540+00:00 app[web.1]: npm ERR! 2020-03-31T13:00:00.242672+00:00 app[web.1]: npm ERR! Failed at the app@4.4.0 start script. 2020-03-31T13:00:00.242798+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Can someone please tell me what is the workaround for this? Or I can't use react-select in SSR?
How can I define window object?

@AleksaButterfly
Copy link
Author

Can someone please help? it's been 20 days since I posted this question. Why can't react-select work on SSR?

@teltploek
Copy link

I had a similar problem. This helped me out: #3802 (comment)

Might be worth a shot in your case too 🤷‍♂️

@bladey bladey added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label May 30, 2020
@bladey
Copy link
Contributor

bladey commented Jun 19, 2020

Hi @AleksaCorona, as mentioned by @teltploek, this issue has been outlined in #3802. I'm going to close this for now so we can keep the issues streamlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet
Projects
None yet
Development

No branches or pull requests

3 participants