10.0.0 • Published 5 years ago

@alexseitsinger/react-ssr v10.0.0

Weekly downloads
1
License
BSD-2-Clause
Repository
github
Last release
5 years ago

React-SSR (Frontend)

A webpack compiler and provider for render and serving server-side react. Expected to be used in combination with React-SSR (Backend)

Installation

yarn add @alexseitsinger/react-ssr

Modules

browserBundle

The entry point for the client-side bundle.

import { browserBundle } from "@alexseitsinger/react-ssr"

export const store = browserBundle({
  App,
  createStore,
  render: (PreparedApp, { store, browserHistory }) => {
    hydrate(<PreparedApp />, document.getElementById("app"))
  }),
})

serverBundle

The entry point for a server-side bundle.

import { serverBundle } from "@alexseitsinger/react-ssr"

export default serverBundle({
  App,
  createStore,
  render: (PreparedApp, { store, serverHistory, url }) => {
    const html = renderToString(<PreparedApp />)
    const state = store.getState()
    return {
      html,
      state,
    }
  },
})

Scripts

The script to start the compilation (development only) and provider servers.

yarn react-server [--address <value> ...]

Options

NameDescriptionDefaultRequired
addressThe address the servers should listen on.0.0.0.0yes
compilerPortThe port the compiler server should use.8081no
providerPortThe port the provider server should ue.8082no
browserConfigThe path to the browser-side webpack config.undefinedyes
serverConfigThe path to the server-side webpack configundefinedyes
renderURLThe endpoint that provides server-side renders./renderno
reducerDirsExtra paths to reducer directories within the app.undefinedno
appPathThe base path to use when finding default state files.undefinedyes
defaultStateURLThe url to use for retrieving default state./defaultStateno
defaultStateFileNameThe file name to look for which contains the default state.defaultState.jsonno
browserStatsURLThe url to use for retrieving the current browser bundle's webpack stats./browserStatsno
browserStatsPathThe path to prepend to the browser stats file.undefinedyes
browserStatsFileNameThe name of the browser stats file.stats.jsonno
secretKeyValueThe secret key value to match against when receiving requests.undefinedno
secretKeyHeaderNameThe name of the header that will contain the secret key.secret-keyno
serverBundlePathThe path to find the server bundle.undefinedyes
serverBundleNameThe name of the server bundle.server.jsno
allowedFilesNames of files that are allowed to be read.webpack.jsonno
ignoredFilesNames of files that are never allowed to be read.undefinedno
10.0.0

5 years ago

9.1.0

5 years ago

9.0.0

5 years ago

8.0.1

5 years ago

8.0.0

5 years ago

7.1.1

5 years ago

7.0.2

5 years ago

7.0.1

5 years ago

6.0.1

5 years ago

5.0.0

5 years ago

3.2.0

5 years ago

3.0.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.5.0

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.6

6 years ago

1.0.2

6 years ago

0.2.12

6 years ago

0.2.11

6 years ago

0.2.10

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago