-
Notifications
You must be signed in to change notification settings - Fork 927
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
'this' is undefined on the server side #176
Comments
Thanks for the report, I'll take a look this weekend. This may be due to how Babel handles |
Looks like I need to blacklist the "strict" transformer. From the Babel docs:
You could try hacking this into the ReactJS.NET Babel config: {"blacklist", new List<string> { "strict" } } If you do try that out, let me know if it works :) |
Fixed in 2.0.1, thanks for reporting! |
Works perfectly, thanks! |
Upon upgrading to 2.0 the server side rendering broke:
To render numbers and dates in an i18n compatible way I'm using numeral.js and moment.js. Both of them are written in a way that uses
this
as the global object, likeOr
They are both valid in a browser or a node.js environment, but the following fails:
ReactConfig.cs:
Index.cshtml:
Since it cannot set the property 'numeral' of undefined.
This pretty much blocks me from upgrading to React.Core 2.0 and therefore React 0.14.
The text was updated successfully, but these errors were encountered: