-
Notifications
You must be signed in to change notification settings - Fork 104
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
WIP: Replace jsdom with chrome headless #44
Conversation
Things to discuss:
|
This is great - I haven't had much success with other pre-rendering solutions. I ran into the jsdom limitations pretty quickly (localStorage) so checked out the PR. However, I don't use create-react-app on the project I wanted to pre-render and had some other needs, so thought I'd add some thoughts:
I found https://github.com/GoogleChrome/puppeteer, which allows me to set the userAgent and also intercept requests and reject any that do not start with |
There's been no discussion on this MR and it looks like the project has taken a different path so I'm tempted to close this. |
Sorry I've been super busy recently. Yes, puppeteer looks like the best of the bunch. Yes, JSDOM is not long for this world—there are too many incompatibilities with modern apps. The current thing I'm trying to figure out is whether it'll be possible to run during a deploy on Heroku or not. Basically, this project is gradually orbiting towards a real v2 release backed by Chrome headless and with full async support. It'll probably require React 16+ due to a much more friendly rehydration API. But I'm absolutely taking this PR as the inspiration for all that work. I hope I can get it all released soon! |
@geelen just seen this thread about people having a bunch of issues (including with heroku). i guess they're still ironing out some kinks. either way i'm happy to update this MR with puppeteer on top of the async-16 branch if you like? |
@badsyntax @geelen To save you the trouble, I'm happy to chip in with my changes to this PR for puppeteer, either via a new PR or gist, it was quite simple. I'm running the pre-prender locally before deploying to s3, so cannot speak to any Heroku issues. |
Happy to help however needed! |
I were using this awesome project, but because of problems with jsdom wrote small script to do snapshots. It is only 100+ LOC uses puppeteer and highland as a queue. https://github.com/stereobooster/react-snap/blob/master/index.js |
Just FYI, I think using puppeteer is definitely the right choice, but given the presence of react-snap I don't think I'll be implementing that here. I'll either build on top of or merge with that project going forward. Apologies for not getting this merged straight away, and leaving this project lapse for a while. Closing this now in favour of #80 |
@geelen No apology required! Thanks for your great work and ideas on this project. I think the original goal of the PR has been achieved, in a somewhat roundabout way, via react-snap using puppeteer. Hopefully there can be some collaboration around async support in the future. |
I've marked this as a WIP as it's not ready to merge.
This is just an initial pass at replacing jsdom with chrome headless. Let's get a discussion going.
Thing change brings some PROS:
And some CONS:
Note this change also includes: