Skip to content

Commit 99d573c

Browse files
committed
docs: explain static builds only with examples
1 parent 5f5739c commit 99d573c

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,50 @@ After a successful build, the builder checks that the prerendered pages actually
124124

125125
## 📁 Known limitations <a name="limitations"></a>
126126

127-
- **Static builds only.** With `"outputMode": "server"` (or SSR without `outputMode`) the build fails, because the Angular SSR server looks up prerendered pages as `index.html`. An SSR entry that only renders at build time is fine.
127+
- **Static builds only.** `prerenderFormat: "file"` is for static hosting. An `ssr` entry is fine as long as `"outputMode"` is `"static"`: Angular then uses it only during `ng build` to prerender the pages, and no server is deployed. If a server is deployed, the build fails: a server needs no `.html` files, it answers `/foo` directly without redirecting to `/foo/`, and the Angular SSR server looks up prerendered pages as `index.html`.
128+
129+
✅ Works: static output, the `ssr` entry only renders at build time
130+
131+
```json
132+
"options": {
133+
"outputMode": "static",
134+
"server": "src/main.server.ts",
135+
"ssr": { "entry": "src/server.ts" },
136+
"prerenderFormat": "file"
137+
}
138+
```
139+
140+
✅ Works: prerendering without SSR
141+
142+
```json
143+
"options": {
144+
"server": "src/main.server.ts",
145+
"prerender": true,
146+
"prerenderFormat": "file"
147+
}
148+
```
149+
150+
❌ Fails: a server is deployed
151+
152+
```json
153+
"options": {
154+
"outputMode": "server",
155+
"server": "src/main.server.ts",
156+
"ssr": { "entry": "src/server.ts" },
157+
"prerenderFormat": "file"
158+
}
159+
```
160+
161+
❌ Fails: SSR without `outputMode` also deploys a server
162+
163+
```json
164+
"options": {
165+
"server": "src/main.server.ts",
166+
"ssr": { "entry": "src/server.ts" },
167+
"prerenderFormat": "file"
168+
}
169+
```
170+
128171
- **`ng test` warning.** The `@angular/build:unit-test` builder logs a warning when its `buildTarget` uses a builder other than `@angular/build:application`. Tests run normally.
129172

130173
## 🏁 License <a name="license"></a>

0 commit comments

Comments
 (0)