0

I've been building a site for a client using CRA(create-react-app) and react-router v4.2.0 and was unaware of the implications regarding google's SEO. When I index the page from Google Search Console, I get this: Google Search Console Result

I found several similar issues which suggested adding 'babel-polyfill' to my entry point, but this only causes my root component to render in the console, not taking into account my react-router routes. I'm aware that CRA is not designed for SSR. I was hoping to find a workaround within CRA, or migrate gracefully to another library such as Next.js without having to rebuild the entire site. Let me know if any additional information is needed. Thanks for any suggestions.

2
  • have you tried googling a little bit? there are few articles like medium.com/bucharestjs/… medium.com/@cereallarceny/… etc. Commented Jun 13, 2018 at 23:31
  • I've done quite a bit of googling. The method in the second article proved to no avail (lots of rather unhelpful errors when spinning up my server). I'll check out the first one thanks. Commented Jun 14, 2018 at 1:35

1 Answer 1

1

You can try on https://github.com/antonybudianto/cra-universal/

It's a CLI companion for universal create-react-app, without eject + zero config by default.

$ cd my-cra-app
$ npm start // start CRA client
$ npx cra-universal start // start CRA server

For existing code, you need to customize, it depends on your app's stack. You can visit the repo's wiki for React router/redux integration on server.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.