@nx/react:federate-module

Create a federated module, which can be loaded by a Consumer (host) via a Producer (remote).

Usage

1nx generate federate-module ... 2

By default, Nx will search for federate-module in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

1nx g @nx/react:federate-module ... 2

Show what will be generated without writing to disk:

1nx g federate-module ... --dry-run 2

Examples

Create a federated module from myRemote, that exposes my-cmp from ./src/component/my-cmp.ts as MyModule.:

1nx g federate-module MyModule --path=./src/component/my-cmp.ts --remote=myRemote --remoteDirectory=apps/myRemote 2

Create a federated module from myProducer, that exposes my-cmp from ./src/component/my-cmp.ts as MyModule.:

1nx g federate-module MyModule --path=./src/component/my-cmp.ts --producer=myProducer --producerDirectory=apps/myProducer 2

Options

name

Required
string
Pattern: ^[a-zA-Z][^:]*$

The name of the module.

path

Required
string

The path to locate the federated module. This path should be relative to the workspace root and the file should exist.

remote

producerRequired
string

The name of the Producer (remote).

bundler

string
Default: rspack
Accepted values: rspack, webpack

The bundler to use.

e2eTestRunner

string
Default: cypress
Accepted values: cypress, playwright, none

Test runner to use for end to end (E2E) tests.

host

string

The Consumer (host) application for this Producer (remote).

linter

string
Default: eslint
Accepted values: eslint

The tool to use for running lint checks.

remoteDirectory

producerDirectory
string

The directory of the new Producer (remote) application if one needs to be created.

style

s
string
Default: none

The file extension to be used for style files.

unitTestRunner

string
Default: jest
Accepted values: jest, none

Test runner to use for unit tests.

skipFormat

Internal
boolean
Default: false

Skip formatting files.