0

Is there a way to create a react app with server side rendering without using express js as server or Next.js for example?

Can I just use webpack to do server side rendering?

3
  • How do you do server side rendering without a server? Webpack is just a file bundler, it is never about anything related to a server. Commented Sep 4, 2018 at 16:54
  • thanks its that what i want to know... Commented Sep 4, 2018 at 16:55
  • 1
    It sounds like you're looking for a static site generator. SSR actually renders HTML on the fly in response to http requests. A static site generator builds your HTML once and then you can serve that static files over and over again. Commented Sep 4, 2018 at 16:57

3 Answers 3

0

You must have express or any language http server setup to host your files if you ever want to have this app live regardless if you want to have SSR or not.

https://survivejs.com/webpack/output/server-side-rendering/

This guide should help you out with webpack and express

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

1 Comment

Of course! Please accept my answer if this suites you well
0

If you really need static rendered files from react durring webpack build, look at this plugin: https://github.com/thread/react-static-render-plugin/

Comments

0

In production, the JS output for SSR needs to be required by node with expressjs or other web frameworks. Or you can use FaaS(Azure Function, AWS Lambda) to require that JS output to perform SSR

In development, you can have a try this webpack plugin. It reuses webpack-dev-server response dynamic html based on request parameter

It has two examples from simple react app to advanced react-relay app

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.