-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
can't execute file bin/server.js error given was window is not defined #740
Comments
@danmarshall any chance you can help with this? |
Hi @AlanSutherland rendering on the server is not a supported scenario. The Web Chat control only works in a purely client side, DOM environment. |
@danmarshall thanks for the reply, I'm not rendering on the server, I found a workaround by requiring webchat within componentDidMount so it's only rendered client-side |
@AlanSutherland ok, so the styling is just simple CSS files that you will need to reference somewhere in your HTML document. |
@danmarshall It's not a problem with styling, I've updated the SASS. But the stylesheet isn't being loaded. Guess either it isn't rendering properly or I messed up my build somehow? The main thing I want help with this is understanding these error messages that are shown when I try to send a message:
|
We did a bad thing here, the stateless React component should not return @AlanSutherland are you interested in making a PR for this? |
@compulim sure, please grant me permissions so I can create a branch? |
Instead, please fork the repo and create a branch there. |
@compulim what's wrong with returning null there? |
My bad. Looks like React team fixed returning @AlanSutherland are you on React 14 for this? |
yep using 15.6.1 |
@AlanSutherland is the problem fixed now? |
Closing due to inactivity. |
I'm building a React app based on React Redux Universal Hot Example
This uses isomorphic/universal js so all code must work on both the server & client.
I would like to embed a custom build of webchat in my app. I've followed your readme, an iframe works but since I can't customise the styling it is not an option. I've cloned your repo, updated the styling and published my project to npm as suggested here.
I'm able to npm install my custom build of webchat as a dependency on my main app, however, importing it in to a component is another kettle of fish..
This is your example:
For starters Import should be import but more importantly when I add this I get this error:
Digging in to this it appears to be an isomoprhic issue, the server doesn't know what window is. I found a workaround so that webchat is only run on the client-side, this took time and still it's not really working. By requiring the webchat module after componentDidMount I can get around the isomorphic issue:
The problem now is that while the chat window is embedded it has none of it's styling feeding through and when I try to send a message I get a lot of errors:
I'm lost, please help. If you'd like to check my build of webchat it's available via npm install webchat-style https://www.npmjs.com/package/webchat-style
The text was updated successfully, but these errors were encountered: