Client-Side Rendering
Client-Side Rendering (CSR) executes page rendering in the browser. When a Node.js service cannot be deployed, static index.html can be generated during the build phase to achieve pure Client-Side Rendering.
Usage Scenarios
The following scenarios are recommended for using Client-Side Rendering:
- Static Hosting Environments: Hosting services that don't support SSR, such as GitHub Pages, CDNs, etc.
- Simple Applications: Small applications with minimal requirements for first-screen loading speed and SEO.
- Development Environment: Quickly preview and debug applications during development.
Configuration Instructions
HTML Template Configuration
The template should include resource injection and entry order: preload and css in head, while importmap, moduleEntry, and modulePreload should be in body.
src/entry.server.ts
Static HTML Generation
Static HTML files can be generated during the build phase through the postBuild hook:
src/entry.node.ts