nx icon indicating copy to clipboard operation
nx copied to clipboard

Broken recipe Module Federation with SSR for Angular

Open LadaBr opened this issue 1 year ago • 3 comments

Current Behavior

I just follow all steps in: https://nx.dev/recipes/module-federation/module-federation-with-ssr and when I run npx nx serve-ssr store --devRemotes=checkout it throws error:

Error: Shared module is not available for eager consumption: 4112

4112 = @angular/platform-server

It is required as eager module because it is imported in main.server.ts for bootstrap of ngExpressEngine

Expected Behavior

It should start the server without any errors.

GitHub Repo

No response

Steps to Reproduce

  1. Follow steps in https://nx.dev/recipes/module-federation/module-federation-with-ssr
  2. Get error on last step

Nx Report

Node   : 20.2.0
   OS     : win32 x64
   npm    : 9.6.6
   Hasher : Native

   nx (global)        : 16.2.2
   nx                 : 16.2.2
   @nx/js             : 16.2.2
   @nx/jest           : 16.2.2
   @nx/linter         : 16.2.2
   @nx/workspace      : 16.2.2
   @nx/angular        : 16.2.2
   @nx/cypress        : 16.2.2
   @nx/devkit         : 16.2.2
   @nx/eslint-plugin  : 16.2.2
   @nrwl/tao          : 16.2.2
   @nx/web            : 16.2.2
   @nx/webpack        : 16.2.2
   nx-cloud           : 16.0.5
   typescript         : 5.0.4
   ---------------------------------------
   Community plugins:
   @nguniversal/builders       : 16.0.2
   @nguniversal/express-engine : 16.0.2

Failure Logs

No response

Operating System

  • [ ] macOS
  • [ ] Linux
  • [X] Windows
  • [ ] Other (Please specify)

Additional Information

No response

LadaBr avatar May 25 '23 13:05 LadaBr

Hi @LadaBr, We also had this issue #15562 . The only workaround we could have was to run it inside a docker container. You might also have the option to mark certain modules as 'eager' in federation configs; However, this is somewhat cumbersome as you need to do this manually for each problematic dependency. Hope it helps.

hamedbavafa avatar Jun 07 '23 09:06 hamedbavafa

Any update on this? I am still facing this problem?

hardikpatel043 avatar Aug 03 '23 10:08 hardikpatel043

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar Jan 31 '24 00:01 github-actions[bot]

Issue still persist

hardikpatel043 avatar Feb 15 '24 07:02 hardikpatel043

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[bot] avatar Mar 17 '24 00:03 github-actions[bot]