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

207
Vistas
Is there something like Jquery Require function in vanilla JS

I have use requirJS require function, but I want something like this in vanilla javaScript. How do I resolve this?

require(['underscore', 'jquery', 'settings', 'text!/core/users/settings.js/?v=' + (+new Date)], function (_, $, Settings, userSettings) {

    userSettings = (typeof userSettings === "object" || typeof userSettings === 'function') && (userSettings !== null) ? userSettings : JSON.parse(userSettings)
    console.log('settings', Settings);
    

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

0

The function require (at least the one you are using) is part of Require.js and has nothing to do with jQuery. It implements AMD modules.

Browsers have no native support for AMD modules.

Modern browsers do have native support for ECMAScript modules.

Use <script type="module"> to load the module that acts as your entry point.

You can then use import (e.g. import defaultExport from 'url/to/module.js') to import values exported (e.g. export default someVariable;) from that module.

MDN has further information on the subject.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Simply put, you’d want to use <script> tags to use the other libraries.

Alternatively, you may be able to use the async “import()” syntax.

Even more alternatively, you could be super jank about it and send a request to fetch the library from some CDN or NPM’s tarball (though the NPM solution probably won’t work due to having to decompress the .tar file), then set some variable equal to the received fetch data, essentially emulating what the <script> tag will do for you, but in plain JS.

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