j-toker
j-toker copied to clipboard
Using J-toker while server side rendering fails due to JSExec error
Hi! I had to give up using J-Toker because while server side rendering it encounter some issues due to some of its dependencies. This is the (JSExec
) error:
TypeError: Object function ( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
} has no method 'extend'
I know it's not priority one, but I hope you can figure something out to make it work without the offending dependency. Right now I'm super busy trying to finish this project, but when I'm done, I'll try to contribute. If you guys figure something out, please let me know!
I'm using Ruby on Rails with react-rails
, devise_token_auth
, flux
and browserify
. You can find the repo here if you want to reproduce the error and the setup.
Hi, I'm about to release a library that should address this. It uses isomorphic-fetch
instead of jQuery.ajax
, and it will come with a server-side rendering example.
That's good news! any estimate time of release? please let me know! Yes, I've come to realize that jQuery
was the origin of the issue, since it depends on a document
element. which doesn't exist on the server side. I tried using jQuery
version ^2.1.4
with [email protected]
which was supposed to work on the server side, but didn't get any result. I kept getting the same error. Maybe j-Toker
uses its own version internally.
@throoze - i'm literally writing the last test now. I'll need to finish the documentation and launch the example app to heroku, and that's it.
Excellent! Please let me know when its released and I'll be your first beta tester lol
Ok I think this is ready for beta testing: https://github.com/lynndylanhurley/redux-auth
Please check it out and let me know if you have any feedback :smiley:
Thanks! one thing is, i'm not using redux, but instead vanilla flux, is redux required for using this library?
Yeah it's a requirement. Sorry!