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

Issue with server side rendering #14

Open
abhinavsingi opened this issue Sep 14, 2016 · 2 comments
Open

Issue with server side rendering #14

abhinavsingi opened this issue Sep 14, 2016 · 2 comments

Comments

@abhinavsingi
Copy link

var _Raven = window.Raven; errors out when server side rendering is done.

When we import import ravenMiddleware from 'redux-raven-middleware'; for redux integration with raven, server side doesn't have window object due to which the above mentioned line errors out.

We can add conditional execution of this middleware but since the declaration is done at compile time we're unable to escape that

@philipchmalts
Copy link

So to circumvent this a little bit, I added this work around,

    if (typeof window === 'undefined') {
    return store => next => action => next(action); //eslint-disable-line
  }

  Raven = require('raven-js');
    if (typeof window === 'undefined') {
    return store => next => action => next(action); //eslint-disable-line
  }

  Raven = require('raven-js');
  if (!Raven.isSetup()) {
    ...etc
  }

Prevents raven from getting required on the server side.

@captbaritone
Copy link
Collaborator

Are you still encountering this error?

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

No branches or pull requests

3 participants