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

101
Vistas
Ignore and skip requirejs dependency

In my webapplication I have ReactJS bundled together with the my code and included as into html page. We also have set of modules that we load using requireJs. And one of those modules is built using WebPack as umd target.

Whenever the client tries to load that module using requireJS, requirejs also tries to load React and ReactDOM because of that line in the module:

define(["React", "ReactDOM"], factory);

But I don't want require to donwload React and ReactDOM since it already loaded. How to I let requireJS know that this module is already loaded and there is no need to load it again?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can define a set of named dummy modules, prior to loading your module.

define('React', function() {
    // return the React global (if there is one)
    return React; 
});

define('ReactDOM', function() { 
    // return the ReactDOM global (if there is one)
    return ReactDOM; 
});

That will "trick" Require into thinking they are already loaded... which they are.

Note: I'm not familiar with React so you may need to return something different. It is going to depend on how you've included React and ReactDOM in you webpage prior to this.

over 4 years ago · Santiago Trujillo 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