Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
63c4b60
update deps, apply prettier, change to ESM, update tests
hrishikesh-k May 12, 2026
d723b43
update ci tests to use Node 22
hrishikesh-k May 13, 2026
a41c8f4
coderabbit 1
hrishikesh-k May 13, 2026
5228f75
remove exclude
hrishikesh-k May 13, 2026
a772d28
update lockfiles
hrishikesh-k May 13, 2026
aa3369d
lint fixes
hrishikesh-k May 13, 2026
a87042c
fix prettier config
hrishikesh-k May 13, 2026
f17a9b0
fix npm ci
hrishikesh-k May 13, 2026
2d4a587
coderabbit 2
hrishikesh-k May 13, 2026
0fed716
downgrade and pin angular
hrishikesh-k May 13, 2026
a4c1f7e
update engine version range to match Angular
hrishikesh-k May 13, 2026
49f5442
fix version and readme
hrishikesh-k May 13, 2026
8ee6796
update readme to suggest latest CLI
hrishikesh-k May 13, 2026
1967b06
add allowedHosts and trustedProxyHeaders
hrishikesh-k May 14, 2026
43517b0
Merge branch 'main' into hk/angular-22
hrishikesh-k May 14, 2026
e47da59
regenrate lockfiles
hrishikesh-k May 14, 2026
65c394d
fix type for getContext
hrishikesh-k May 15, 2026
766344a
update readme for deploy instructions
hrishikesh-k May 15, 2026
ed297f1
prevent missing env vars from failing build
hrishikesh-k May 15, 2026
306b642
fix for loop bug
hrishikesh-k May 15, 2026
a3cb3b7
update swapped file templates
hrishikesh-k May 15, 2026
fc84504
Merge branch 'main' into hk/angular-22
hrishikesh-k May 15, 2026
9877951
fix context potentially being undefined
hrishikesh-k May 15, 2026
74d27cc
consolidate app-engine exports in a single file
hrishikesh-k May 15, 2026
dc29e1a
conditionally update Angular config
hrishikesh-k May 15, 2026
846d7fc
revert pathname to request
hrishikesh-k May 15, 2026
35aa5cb
fix typo
hrishikesh-k May 15, 2026
065cff2
Merge branch 'main' into hk/angular-22
hrishikesh-k May 18, 2026
4a44694
fix merge conflicts
hrishikesh-k May 18, 2026
ca53395
Merge branch 'main' into hk/angular-22
hrishikesh-k May 18, 2026
285d979
match version of angular/ssr instead of core
hrishikesh-k May 18, 2026
5cafda5
Update README.md
hrishikesh-k May 18, 2026
d8af697
seperate version detection for angular/core and ssr
hrishikesh-k May 18, 2026
08952e1
update tests
hrishikesh-k May 18, 2026
095815b
update failBuild message and remove dead code
hrishikesh-k May 18, 2026
6058b19
Merge branch 'main' into hk/angular-22
hrishikesh-k May 19, 2026
3d96443
update readme
hrishikesh-k May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ If you are using Server-Side Rendering you will need to install Angular Runtime

### Manual Installation

If you need to pin this plugin to a specific version or if you are using Server-Side Rendering with Angular 19 or Angular 20, you will need to install the plugin manually.
If you need to pin this plugin to a specific version or if you are using Server-Side Rendering with Angular 19+, you will need to install the plugin manually.

Install it via your package manager:

Expand Down Expand Up @@ -108,26 +108,29 @@ Note that App Engine in Angular 19 is in Developer Preview and requires explicit

Starting with Angular@19. The build plugin makes use of the `server.ts` file to handle requests. The default Angular scaffolding generates incompatible code for Netlify so the build plugin will swap it for compatible `server.ts` file automatically if it detects default version being used.

Make sure you have `@netlify/angular-runtime` version 2.2.0 or later installed in your project. Netlify compatible `server.ts` file imports utilities from this package and Angular Compiler need to be able to resolve it and it can only do that if it's installed in your project and not when it's auto-installed by Netlify.
Make sure you have `@netlify/angular-runtime` version 4.0.0 or later installed in your project. Netlify compatible `server.ts` file imports utilities from this package and Angular Compiler need to be able to resolve it and it can only do that if it's installed in your project and not when it's auto-installed by Netlify.

### Customizing request handling

If you need to customize the request handling, you can do so by copying one of code snippets below to your `server.ts` file.

If you are using Angular 20 or Angular 19 with App Engine Developer Preview:
If you are using `@angular/ssr@21.2.9+` with AppEngine:

```ts
import { AngularAppEngine, createRequestHandler } from '@angular/ssr'
import { getContext } from '@netlify/angular-runtime/context.js'
import { getAllowedHosts, getContext, getTrustProxyHeaders } from '@netlify/angular-runtime/app-engine.js'

const angularAppEngine = new AngularAppEngine()
const angularAppEngine = new AngularAppEngine({
allowedHosts: getAllowedHosts(),
trustProxyHeaders: getTrustProxyHeaders(),
})

export async function netlifyAppEngineHandler(request: Request): Promise<Response> {
const context = getContext()

// Example API endpoints can be defined here.
// Uncomment and define endpoints as necessary.
// const pathname = new URL(request.url).pathname;
// const pathname = new URL(request.url).pathname
// if (pathname === '/api/hello') {
// return Response.json({ message: 'Hello from the API' });
// }
Expand All @@ -142,7 +145,12 @@ export async function netlifyAppEngineHandler(request: Request): Promise<Respons
export const reqHandler = createRequestHandler(netlifyAppEngineHandler)
```

If you are using Angular 19 and did not opt into the App Engine Developer Preview:
> **Note:** The snippet above requires `@angular/ssr@21.2.9+`. We strongly recommend upgrading to this version. If you're on an older release:
> - **v19, v20, v21 (before 21.1.5):** omit both `getAllowedHosts` and `getTrustProxyHeaders`.
> - **v21.1.5–21.2.8:** include `getAllowedHosts`, but omit `getTrustProxyHeaders`.
> - **v21.2.9+:** include both `getAllowedHosts` and `getTrustProxyHeaders` (as shown above).

If you are using `@angular/ssr@19` and did not opt into the App Engine Developer Preview:

```ts
import { CommonEngine } from '@angular/ssr/node'
Expand All @@ -153,7 +161,7 @@ const commonEngine = new CommonEngine()
export async function netlifyCommonEngineHandler(request: Request, context: any): Promise<Response> {
// Example API endpoints can be defined here.
// Uncomment and define endpoints as necessary.
// const pathname = new URL(request.url).pathname;
// const pathname = new URL(request.url).pathname
// if (pathname === '/api/hello') {
// return Response.json({ message: 'Hello from the API' });
// }
Expand Down Expand Up @@ -181,9 +189,7 @@ The [`server.ts` file](https://angular.dev/guide/ssr#configure-server-side-rende

### Requirements

To use the Angular Runtime while building and deploying with the CLI, you need to have `netlify-cli v26.0.0` installed (or a later version).

Please also make sure to use `ntl deploy --build` (rather than `ntl build && ntl deploy`).
Comment thread
hrishikesh-k marked this conversation as resolved.
To use the Angular Runtime while building and deploying with the CLI, you need to have `netlify-cli v26.0.0` installed (or a later version). To deploy the site via CLI, please use `netlify deploy`. Using `netlify deploy` with the `--no-build` flag is not supported.

## Getting Help

Expand Down
2 changes: 1 addition & 1 deletion context.d.ts → app-engine.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This is duplicating module resolution from package.json#exports
// because some module resolution settings in tsconfig.json are not honoring export maps
// https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution
export * from './src/context.js'
export * from './src/app-engine.js'
2 changes: 1 addition & 1 deletion context.js → app-engine.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This is duplicating module resolution from package.json#exports
// because some module resolution settings in tsconfig.json are not honoring export maps
// https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution
export * from './src/context.js'
export * from './src/app-engine.js'
Loading
Loading