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

ReferenceError: window is not defined #11

Closed
trevordmiller opened this issue Sep 4, 2015 · 8 comments
Closed

ReferenceError: window is not defined #11

trevordmiller opened this issue Sep 4, 2015 · 8 comments

Comments

@trevordmiller
Copy link

When using the setup recommended in react-transform-boilerplate by @gaearon, the .babelrc requires in redbox-react which causes an error because window doesn't exist in Node:

> mocha ./src/**/*.test.js --compilers js:babel/register

/Users/trevordmiller/projects/playground/nexus/node_modules/redbox-react/dist/redbox.js:504
            return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
                                       ^
ReferenceError: window is not defined

It would be cool to have a environment check so that this error isn't thrown when the package is require or imported.

@trevordmiller
Copy link
Author

Also, discussion around this issue has been happening in the react-transform channel in the reactiflux Slack team: https://reactiflux.slack.com/

@gaearon
Copy link
Contributor

gaearon commented Sep 4, 2015

(Just FYI—while this is being fixed, you can easily use any other component for error reporting, including a custom one. It's configurable in .babelrc.)

@mathieumg
Copy link

It would be cool to have a environment check so that this error isn't thrown when the package is require or imported.

👍

you can easily use any other component for error reporting

@aulizko has done https://github.com/aulizko/delicate-error-reporter in the meantime :)

@trevordmiller
Copy link
Author

@mathieumg Yeah, I switched to @aulizko's package and it has worked well running from both the server and client since it has an environment check. The unobtrusive errors are a plus as well :)

@gaearon
Copy link
Contributor

gaearon commented Sep 12, 2015

Anybody wants to make a PR for this?

@aulizko
Copy link
Contributor

aulizko commented Sep 12, 2015

@gaearon I'm working on PR fixing this right now ;)

@gaearon
Copy link
Contributor

gaearon commented Sep 13, 2015

👍

@gaearon
Copy link
Contributor

gaearon commented Sep 14, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants