@nx/angular:setup-ssr

Create the additional configuration required to enable SSR via Angular Universal for an Angular application.

Usage

nx generate setup-ssr ...

By default, Nx will search for setup-ssr in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

nx g @nx/angular:setup-ssr ...
Nx 15 and lower use @nrwl/ instead of @nx/

Show what will be generated without writing to disk:

nx g setup-ssr ... --dry-run

Options

project

Required
string

The name of the application to generate the Angular Universal configuration for.

appId

string
Default: serverAppFormat: html-selector

The appId to use with withServerTransition. Note: This is only used in Angular versions <16.0.0. It's deprecated since Angular 16.

main

string
Default: main.server.tsFormat: path

The name of the main entry-point file.

rootModuleFileName

string
Default: app.server.module.tsFormat: path

The name of the root module file

rootModuleClassName

string
Default: AppServerModule

The name of the root module class.

serverFileName

string
Default: server.ts

The name of the Express server file.

serverPort

number
Default: 4000

The port for the Express server.

standalone

boolean

Use Standalone Components to bootstrap SSR. Note: This is only supported in Angular versions >= 14.1.0.

skipFormat

boolean

Skip formatting the workspace after the generator completes.