nx/packages/angular/docs/module-federation-dev-server-examples.md
Robin Csutorás a08133f440
feat(module-federation): add remote configuration override (#19694)
## Current Behavior

The configuration of the served MFE always passed to the remotes. If a
new configuration is needed to skip one remote (e.g.
`serve:skip-remote1`) but `remote2` then a configuration called
`skip-remote1` is needed in the `remote2`.

## Expected Behavior

Add an ability to override the configuration and the empty
configurations in the remotes can be deleted.

## Related Issue(s)

Fixes #19693
2024-05-08 18:52:37 +01:00

67 lines
1.5 KiB
Markdown

## Examples
{% tabs %}
{% tab label="Basic Usage" %}
The Module Federation Dev Server will serve a host application and find the remote applications associated with the host and serve them statically also.
See an example set up of it below:
```json
{
"serve": {
"executor": "@nx/angular:module-federation-dev-server",
"configurations": {
"production": {
"buildTarget": "host:build:production"
},
"development": {
"buildTarget": "host:build:development"
}
},
"defaultConfiguration": "development",
"options": {
"port": 4200,
"publicHost": "http://localhost:4200"
}
}
}
```
{% /tab %}
{% tab label="Serve host with remotes that can be live reloaded" %}
The Module Federation Dev Server will serve a host application and find the remote applications associated with the host and serve a set selection with live reloading enabled also.
See an example set up of it below:
```json
{
"serve-with-hmr-remotes": {
"executor": "@nx/angular:module-federation-dev-server",
"configurations": {
"production": {
"buildTarget": "host:build:production"
},
"development": {
"buildTarget": "host:build:development"
}
},
"defaultConfiguration": "development",
"options": {
"port": 4200,
"publicHost": "http://localhost:4200",
"devRemotes": [
"remote1",
{
"remoteName": "remote2",
"configuration": "development"
}
]
}
}
}
```
{% /tab %}
{% /tabs %}