nrwl / nx

Smart Monorepos ยท Fast CI
https://nx.dev
MIT License
23.59k stars 2.36k forks source link

Module Federation - content of vendor.js repeated in polyfills.js #21930

Closed hardikpatel043 closed 1 week ago

hardikpatel043 commented 8 months ago

Current Behavior

I created nx workspace and then created shell and remote app using below command.

nx g @nx/angular:host shell --directory=apps/angular/with-remotes/shell --remotes=remote1

This created shell and remote1 app.

I ran shell and remote app using "nx serve shell". This served shell on 4200 port.

When i checked network tab i saw polyfills and vendor files has loaded.

image

I checked content of both file and found that content of vendor.js is repeated in polyfill.js

https://www.diffchecker.com/0XyPfraG/

Expected Behavior

vendor.js files content should not be repeated in polyfills.js

GitHub Repo

https://github.com/hardikpatel043/nx-module-federation

Steps to Reproduce

  1. create nx workspace. "npx create-nx-workspace"
  2. create shell and remote app. "nx g @nx/angular:host shell --directory=apps/angular/with-remotes/shell --remotes=remote1"
  3. run app "nx serve shell"
  4. Check vendor.js and polyfills.js in network tab.

Nx Report

>  NX   Its time to update Nx ๐ŸŽ‰

   Your repository uses a higher version of Nx (18.0.4) than your global CLI version (17.0.2)
   For more information, see https://nx.dev/more-concepts/global-nx

 >  NX   Report complete - copy this into the issue template

   Node   : 18.18.2
   OS     : win32-x64
   npm    : 9.8.1

   nx (global)        : 17.0.2
   nx                 : 18.0.4
   @nx/js             : 18.0.4
   @nx/jest           : 18.0.4
   @nx/linter         : 18.0.4
   @nx/eslint         : 18.0.4
   @nx/workspace      : 18.0.4
   @nx/angular        : 18.0.4
   @nx/cypress        : 18.0.4
   @nx/devkit         : 18.0.4
   @nx/eslint-plugin  : 18.0.4
   @nrwl/tao          : 18.0.4
   @nx/web            : 18.0.4
   @nx/webpack        : 18.0.4
   typescript         : 5.3.3

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

Coly010 commented 6 months ago

Thank you for bringing this issue to our attention! I want to assure you that I will take a look as soon as I can. Your patience and understanding in this matter is greatly appreciated.

hardikpatel043 commented 4 months ago

@Coly010 Hello, did you get chance to look into?

Coly010 commented 2 months ago

Hey @hardikpatel043 :)

Can you try this again with the latest version of Nx (19.5.7)? We switched to using the @module-federation/enhanced package for module federation, and it would be good to confirm if this is still an issue

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! ๐Ÿ™

hardikpatel043 commented 2 months ago

@Coly010 I tried with nx version 19.5.7. Problem still exist.

However, I see package "@module-federation/enhanced": "~0.2.3" installed in package.json.

PS D:\Micro Frontend\test> nx report

NX Its time to update Nx ๐ŸŽ‰

Your repository uses a higher version of Nx (19.5.7) than your global CLI version (17.0.2) For more information, see https://nx.dev/more-concepts/global-nx

NX Report complete - copy this into the issue template

Node : 18.18.2 OS : win32-x64 Native Target : x86_64-windows npm : 9.8.1

nx (global) : 17.0.2 nx : 19.5.7 @nx/js : 19.5.7 @nx/jest : 19.5.7 @nx/linter : 19.5.7 @nx/eslint : 19.5.7 @nx/workspace : 19.5.7 @nx/angular : 19.5.7 @nx/devkit : 19.5.7 @nx/eslint-plugin : 19.5.7 @nrwl/tao : 19.5.7 @nx/web : 19.5.7 @nx/webpack : 19.5.7 typescript : 5.5.4

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! ๐Ÿ™

hardikpatel043 commented 2 months ago

I have already provided result with the latest version of nx

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! ๐Ÿ™

hardikpatel043 commented 1 month ago

I have already provided result with the latest version of nx

isunilmekala commented 1 week ago

Appreciate if any further updates. TIA

Coly010 commented 1 week ago

Hey @hardikpatel043 I cannot access the repo you linked.

I'll try create a new workspace with a single host and remote to check this

Coly010 commented 1 week ago

I can confirm I can see this occurring. However, I can also confirm that I can see this happening with a plain Angular CLI app that uses the Angular Webpack Builder (@angular-devkit/build-angular:browser).

This is something that should be raised on the https://github.com/angular/angular-cli repository.