Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Add SSR how-to #1177

Closed
timkelty opened this issue Oct 15, 2018 · 5 comments
Closed

Add SSR how-to #1177

timkelty opened this issue Oct 15, 2018 · 5 comments
Labels

Comments

@timkelty
Copy link
Contributor

No description provided.

@edmorley
Copy link
Member

Vue's pages for reference:
https://vuejs.org/v2/guide/ssr.html
https://ssr.vuejs.org/

Though reading through those (I've not set up SSR myself before, so served as a starting point) makes me wonder how useful a guide we could create, given that is seems like an SSR implementation is always going to be very framework and project specific.

As mentioned in #1175 (comment) it also feels like this is something that would be good to have documented in webpack's docs - which we could then link to.

@timkelty
Copy link
Contributor Author

timkelty commented Oct 15, 2018

Component rendering SSR (Vue/React) is indeed very platform/app specific, and I think trying to manage our own guide would be tough.

BYO-"traditional"-server-rendering (not sure what else to call it, as SSR typically refers to server-rendering SPAs…) on the other hand is pretty much the same, e.g.:

module.exports = {
  options: {

    // Nest your webpack assets within your web root
    output: 'public/build',
  },
  use: [
    ['@neutrinojs/web', {

      // BYO-HTML
      html: false,

      // Serve everything from `/build/*`
      publicPath: `/${basename(neutrino.options.output)}/`,

      devServer: {
        proxy: {

          // Proxy all requests to your running app
          '**': {
            target: 'http://localhost:3000',

            // Hint to your app if this is a dev-server request or not.
            // If not, parse manifest.json and use hashed assets in your templates.
            headers: {
              Forwarded: 'by=_webpack-dev-server'
            }
          }
        },
      },
    }]
  ]
};

@xyyjk
Copy link

xyyjk commented Jun 14, 2019

A react ssr demo based on neutrino
https://github.com/xyyjk/react-ssr/tree/hooks

@dparker2
Copy link

For disabling the html generation, is simply doing

...
    html: false,
...

the recommended way to do that? Or is it better to remove it from the config like here: #168 (comment)?

@timkelty
Copy link
Contributor Author

@dparker2 you got it. html: false is what you want. That comment pre-dated the option to remove it via false

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants