https://github.com/aslemammad/snowpack-react-ssr
minimal example using snowpack and react server side rendering
https://github.com/aslemammad/snowpack-react-ssr
Last synced: 9 months ago
JSON representation
minimal example using snowpack and react server side rendering
- Host: GitHub
- URL: https://github.com/aslemammad/snowpack-react-ssr
- Owner: Aslemammad
- License: mit
- Fork: true (matthoffner/snowpack-react-ssr)
- Created: 2020-11-22T04:50:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-31T16:05:14.000Z (over 5 years ago)
- Last Synced: 2024-05-02T05:21:11.995Z (about 2 years ago)
- Size: 1010 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# snowpack-react-ssr
Minimal example using React server side rendering with snowpack.
## Features
- Babel node for server side jsx support
- `renderToNodeStream` for improved server rendering performance
- React Refresh works via Snowpack
- Inlines CSS server side for optimal first contentful paint
## Usage
```sh
npm install
```
```sh
npm run start
```
This will launch a server and client dev server, they can be invoked separately:
```sh
npm run server
```
Will run on port 3000 by default.
```sh
npm run client
```
Will run on port 8080 by default.
Server reloading conflicts with hot reloading since a full refresh is needed for server rendered html updates to show. Included is a separate npm script that will restart the server when changes are made to the src directory.
```sh
npm run serve
```
## Production build
```sh
npm run build
```
Included is the webpack plugin to optimize the client build. Also included is `modulepreload` script tags. To run the server in production mode:
```sh
npm run production
```