react-snap icon indicating copy to clipboard operation
react-snap copied to clipboard

React-snap not pre-rendering child routes [Vue]

Open OSquiddy opened this issue 3 years ago • 1 comments

Bug Report

Current Behavior

When postbuild runs, react-snap crawls 3 pages. ['/login', '/', '/404.html']. I have a bunch of child routes that I want to be pre-rendered, but those aren't being crawled.

Reproducible demo

I'm interning with a company, so I'm not allowed to post their software online, but I'm working on recreating the issue in a personal repo. As soon as I have that, I'll update this post, or take it down and reupload a new one. But in the meantime, if someone has faced something similar and know how to solve it, that'd be great to hear

Expected behavior/code

I expected all routes specified in the index.js file to be pre-rendered.

Possible Solution

I'm new to puppeteer, but I think a possible reason for this is that the child pages I need pre-rendered are hidden behind a login screen. I was searching for a way to provide credentials to puppeteer so that it can access those pages, and saw that it is possible. So maybe if you could provide some sort of options, in which we pass login info to react-snap, that might work.

OSquiddy avatar Mar 12 '21 06:03 OSquiddy

This tool works by scraping the site and following any links it finds, so if those links aren't visible anywhere until login, then how can it find them?

A few options

  • add the links to those pages somewhere on a page but hidden from regular users
  • add a new sitemap page that is linked to somewhere that includes explicit links to all of those pages
  • set the app up to detect that it is pre-rendering and behave differently because of it (ie pretend you are logged in) - see https://github.com/stereobooster/react-snap#useragent

theoephraim avatar May 24 '21 03:05 theoephraim