Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

667
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda