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 SSR error: "Shared module is not available for eager consumption" #27000

Open
2 of 4 tasks
S-FurmanBSF opened this issue Jul 19, 2024 · 0 comments
Open
2 of 4 tasks
Assignees
Labels
scope: module federation Issues related to module federation support type: bug

Comments

@S-FurmanBSF
Copy link

S-FurmanBSF commented Jul 19, 2024

Current Behavior

This issue exhibits the same behavior described in #14428. However, the solutions provided there do not seem to work on either Windows or macOS so I decided to open new issue. I couldn't even follow steps from your SSR tutorial. https://nx.dev/recipes/angular/module-federation-with-ssr

Expected Behavior

The code from tutorial should work.

GitHub Repo

No response

Steps to Reproduce

  1. Follow steps from tutorial: https://nx.dev/recipes/angular/module-federation-with-ssr

Nx Report

Node   : 20.11.1
OS     : win32-x64
npm    : 10.2.4

@nx/angular        : 19.5.0
@nx/devkit         : 19.5.0
@nx/eslint-plugin  : 19.5.0
@nrwl/tao          : 19.5.0
@nx/web            : 19.5.0
@nx/webpack        : 19.5.0
typescript         : 5.5.3

Failure Logs

Depending on the OS and nx version I get this errors:


**Windows ("nx": "19.5.0" -> from above nx report):**
Error:
        The loadShareSync function was unable to load @angular/common. The @angular/common could not be found in checkout.
        Possible reasons for failure:

        1. The @angular/common share was registered with the 'get' attribute, but loadShare was not used beforehand.

        2. The @angular/common share was not registered with the 'lib' attribute.


**windows("nx": "18.0.8"):**
if(typeof factory !== "function") throw new Error("Shared module is not available for eager consumption: " + id);
                                                                          ^

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


**mac("nx": 18.0.8):**
SyntaxError: Unexpected token '<'
    at new Script (node:vm:99:7)
    at createScript (node:vm:255:10)
    at Object.runInThisContext (node:vm:303:10)
    at <anonymous> (./webpack/runtime/readFile%20chunk%20loading:51:1)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  message: 'Loading script failed.\n' +
    "(Unexpected token '<': http://localhost:4202/server/remoteEntry.js)",
  name: 'ScriptExternalLoadError'

Package Manager Version

No response

Operating System

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

Additional Information

No response

@AgentEnder AgentEnder added the scope: module federation Issues related to module federation support label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: module federation Issues related to module federation support type: bug
Projects
None yet
Development

No branches or pull requests

3 participants