Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

655
Views
Angular Module Federation -- Shared module is not available for eager consumption

Getting this issue when trying to run tests on my Angular microfrontend to use inside Module Federation. Angular 12, Webpack 5.

Uncaught Error: Shared module is not available for eager consumption: 5487

How to configure eager consumption for these modules?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Create a separate webpack.conf for testing

You can set all shared modules to eager: true in your primary webpack.config.js, but that would force you to use a larger bundle size, one of the things Module Federation aims to avoid.

A better option could be to set up a separate webpack.test.config.js, which will just be used for running tests, and in that file set your modules to eager: true:

webpack.test.config.js

shared: share({
  "@angular/core": { 
    eager: true, 
    singleton: true, 
    strictVersion: true, 
    requiredVersion: 'auto' 
  },
  "@angular/common": { 
    eager: true, 
    singleton: true, 
    strictVersion: true, 
    requiredVersion: 'auto' 
  },
  "@angular/common/http": { 
    eager: true, 
    singleton: true, 
    strictVersion: true, 
    requiredVersion: 'auto' 
  }
})
about 4 years ago · Juan Pablo Isaza Report

0

In most cases, solve this issue by setting eager: true on your shared common Angular modules:

        
shared: share({
  "@angular/core": { singleton: true, strictVersion: true, requiredVersion: 'auto', eager: true },
  "@angular/common": { singleton: true, strictVersion: true, requiredVersion: 'auto', eager: true },
  "@angular/common/http": { singleton: true, strictVersion: true, requiredVersion: 'auto', eager: true },
  "@angular/router": { singleton: true, strictVersion: true, requiredVersion: 'auto', eager: true },

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!