fix(react): mf remote name incorrect with directory option #17430
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Behavior
When a developer generates a remote via CLI and passes in a directory (e.g.
▶ yarn nx generate @nrwl/react:remote --name=test --host=host-name --directory=apps/host-name/applications
), the remote uses the project name, while the host does not use the project name.Then the developer must take the following steps to run their host without error:
apps/host-name/src/remotes.d.ts
.declare module "test/Module";
>>declare module "host-name-applications-test/Module";
apps/host-name/module-federation.config.ts
.This is because Nx uses the directory to prepend the project name, and passing in options.name to the host does not prepend the directory. Therefore passing in a directory to the CLI will mean that the parameter passed in to the
updateHostWithRemote
method will always be incorrect.Expected Behavior
When a developer generates a remote via CLI and passes in a directory, the remote and the host both use the project name. There is no need to update either the
remotes.d.ts
ormodule-federation.config.ts
files.Related Issue(s)
#16308
Fixes #