@nx/angular:setup-mf

Create Module Federation configuration files for given Angular Application.

Examples

The setup-mf generator is used to add Module Federation support to existing applications.

To convert an existing application to a host application, run the following

1nx g setup-mf myapp --mfType=host --routing=true 2

Usage

1nx generate setup-mf ... 2

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

You can specify the collection explicitly as follows:

1nx g @nx/angular:setup-mf ... 2

Show what will be generated without writing to disk:

1nx g setup-mf ... --dry-run 2

Options

appName

Required
string

The name of the application to generate the Module Federation configuration for.

mfType

Required
string
Default: remote
Accepted values: host, remote

Type of application to generate the Module Federation configuration for.

routing

boolean

Generate a routing setup to allow a Consumer (host) application to route to the Producer (remote) application.

e2eProjectName

string

The project name of the associated E2E project for the application. This is only required for Cypress E2E projects that do not follow the naming convention <appName>-e2e.

federationType

string
Default: static
Accepted values: static, dynamic

Use either Static or Dynamic Module Federation pattern for the application.

host

consumer
string

The name of the host application that the remote application will be consumed by.

port

number

The port at which the remote application should be served.

prefix

string

The prefix to use for any generated component.

remotes

producers
Array<anything>

A list of remote application names that the Consumer (host) application should consume.

skipE2E

boolean
Default: false

Do not set up E2E related config.

standalone

boolean
Default: true

Whether the application is a standalone application.

setParserOptionsProject

boolean
Default: false

Whether or not to configure the ESLint parserOptions.project option. We do not do this by default for lint performance reasons.

typescriptConfiguration

boolean
Default: true

Whether the module federation configuration and webpack configuration files should use TS.

skipFormat

Internal
boolean

Skip formatting the workspace after the generator completes.

skipPackageJson

Internal
boolean
Default: false

Do not add dependencies to package.json.