react-snap not detecting all routes

2.6k Views Asked by At
  <BrowserRouter>
        <Switch>
            <Route
                exact
                path="/"
                component={EmailVerification}
            />
            <Route exact path={urlConfig.cashback} component={Cashback} /> 

            <Route
                exact
                path={urlConfig.emailVerificationFailure}
                component={EmailVerification}
            />
       </Switch>
  </BrowserRouter>

This is my routes. When I am using react-snap post build, only the first route gets crawled, not the other routes.

This is my package.json

   "reactSnap": {
    "inlineCss": true,
    "fixWebpackChunksIssue": false
}

Can anyone let me know what could be the issue?

1

There are 1 best solutions below

2
On

Did you actually have these routes linked somewhere? Crawler (headless Chrome) analyses HTML structure. If you haven't linked these pages anywhere it won't know they exist. Try to add <a href="/emailverificationfailure">test</a> to your page and I am pretty sure it will get crawled. The real question is - why do you want it to be crawled?

The purpose of pre-rendering is mostly SEO, the Google Bot or crawler will use the same technique to crawl. You don't want to index your Email Verification Failure page, right?

If you want that page to still work, it should as your app.js file is still there.