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

433
Vistas
Webpack module federation error: Cannot read properties of undefined (reading 'call')

I am trying to create the most basic webpack module federation proof of concept example.

Webpack config in the host app:

...
  plugins: [
    new ModuleFederationPlugin({
      name: "hostApp",
      remotes: {
        libApp: `libApp@http://localhost:3000/libApp`,
      },
    }),
  ],
...

Webpack config in the dependency app:

...
  plugins: [
    new ModuleFederationPlugin({
      name: "libApp",
      filename: "libApp.js",
      exposes: {
        "./moduleA": "./src/moduleA",
        "./moduleB": "./src/moduleB",
      }
    })
  ],
...

Here is the reproduction repo

What is wrong with this configuration?

Also, is it possible to set up dependency app to export a single js file with all exposed modules included (as a single webpack module)?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can fix this creating a new file "bootstrap.js" in hostApp.

// src/bootstrap.js
console.log('host app test')

import moduleA from 'libApp/moduleA'
import moduleB from 'libApp/moduleB'

const el = document.getElementById('hostAppContainer')

el.innerHTML = 'changedContent: ' + moduleA + moduleB

and then change your index.js to

// src/index.js

import("./bootstrap");

This was caused by trying to do module federation in the initial entry point, which webpack doesn't like you doing.

about 4 years ago · Juan Pablo Isaza Denunciar

0

I see several things.

  1. I think the remotes property goes in the dependent apps as a link back to the host application.
  2. Similarly, I think you'll need a filename inside the host application's configuration for remote access.
  3. It looks odd to me to have your dependent apps directly inside the src directory and not inside src/app.
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