Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module federation dev server does not calculate shared dependencies correctly when multiple dev remotes are used. #21391

Closed
1 of 4 tasks
statop opened this issue Jan 29, 2024 · 3 comments · Fixed by #21416
Closed
1 of 4 tasks
Assignees
Labels

Comments

@statop
Copy link

statop commented Jan 29, 2024

Current Behavior

Module federation dev server does not calculate shared dependencies correctly when multiple dev remotes are used.

Expected Behavior

Module federation dev server does calculates shared dependencies correctly when multiple dev remotes are used.

GitHub Repo

No response

Steps to Reproduce

  1. Run a module federation dev server with multiple dev remotes, note that shared dependencies are not correctly shared.

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.17.1
   OS     : darwin-arm64
   pnpm   : 8.14.3

   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/angular        : 17.2.8
   @nx/devkit         : 17.2.8
   @nx/eslint-plugin  : 17.2.8
   @nx/node           : 17.2.8
   @nx/plugin         : 17.2.8
   @nx/react          : 17.2.8
   @nx/rollup         : 17.2.8
   @nx/storybook      : 17.2.8
   @nx/vite           : 17.2.8
   @nx/web            : 17.2.8
   @nx/webpack        : 17.2.8
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @openadp/tools-plugin : 24.5.0
   @storybook/angular    : 7.6.10
   ---------------------------------------
   Local workspace plugins:
   	 @openadp/tools-plugin

Failure Logs

No response

Package Manager Version

pnpm 8.14.3

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

The core problem is the caching of ts path mappings in here https://github.com/nrwl/nx/blob/master/packages/webpack/src/utils/module-federation/typescript.ts#L7

That can cause the calculated path of one project to be used for a totally separate project when they are run in the same process.

@Coly010
Copy link
Contributor

Coly010 commented Jan 30, 2024

@statop Thanks for raising this!

Would it be possible for you to create a minimal repo that reproduces this issue? I'm not exactly sure what you mean by "not correctly shared".

I have an idea on how to potentially fix this but I'm not sure how to test it because I don't know exactly what is incorrect here.

@statop
Copy link
Author

statop commented Jan 30, 2024

@Coly010

Added a comment to your pr. If you fix that it will probably fix this bug.

I don't really have time to create a repro.

Copy link

github-actions bot commented Mar 2, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants